Skip to content

Commit

Permalink
Try to fix asan and gcanalyze
Browse files Browse the repository at this point in the history
  • Loading branch information
gbaraldi committed Nov 24, 2023
1 parent 633e656 commit 63f4afb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/clangsa/GCChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ bool GCChecker::processPotentialSafepoint(const CallEvent &Call,
isGCTrackedType(ParmType->getPointeeType())) {
// This is probably an out parameter. Find the value it refers to now.
SVal Loaded =
State->getSVal(Call.getArgSVal(i).getAs<Loc>().getValue());
State->getSVal(*(Call.getArgSVal(i).getAs<Loc>()));
SpeciallyRootedSymbol = Loaded.getAsSymbol();
continue;
}
Expand Down Expand Up @@ -1520,7 +1520,7 @@ bool GCChecker::evalCall(const CallEvent &Call, CheckerContext &C) const {
}
}
if (FD) {
Loc ItemsLoc = State->getLValue(FD, ArrayList).getAs<Loc>().getValue();
Loc ItemsLoc = *(State->getLValue(FD, ArrayList).getAs<Loc>());
SVal Items = State->getSVal(ItemsLoc);
if (Items.isUnknown()) {
Items = C.getSValBuilder().conjureSymbolVal(
Expand Down Expand Up @@ -1688,7 +1688,7 @@ void GCChecker::checkLocation(SVal SLoc, bool IsLoad, const Stmt *S,
// better than this.
if (IsLoad && (RS = State->get<GCRootMap>(SLoc.getAsRegion()))) {
SymbolRef LoadedSym =
State->getSVal(SLoc.getAs<Loc>().getValue()).getAsSymbol();
State->getSVal(*SLoc.getAs<Loc>()).getAsSymbol();
if (LoadedSym) {
const ValueState *ValS = State->get<GCValueMap>(LoadedSym);
if (!ValS || !ValS->isRooted() || ValS->RootDepth > RS->RootedAtDepth) {
Expand Down
8 changes: 7 additions & 1 deletion src/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,10 +157,16 @@ namespace {
// Opts.UseAfterScope = CodeGenOpts.SanitizeAddressUseAfterScope;
// Opts.UseAfterReturn = CodeGenOpts.getSanitizeAddressUseAfterReturn();
// MPM.addPass(RequireAnalysisPass<ASanGlobalsMetadataAnalysis, Module>());
//Let's assume the defaults are actually fine for our purposes
#if JL_LLVM_VERSION < 160000
// MPM.addPass(ModuleAddressSanitizerPass(
// Opts, UseGlobalGC, UseOdrIndicator, DestructorKind));
//Let's assume the defaults are actually fine for our purposes
MPM.addPass(ModuleAddressSanitizerPass(AddressSanitizerOptions()));
#else // LLVM 16+
// MPM.addPass(AddressSanitizerPass(
// Opts, UseGlobalGC, UseOdrIndicator, DestructorKind));
MPM.addPass(AddressSanitizerPass(AddressSanitizerOptions()));
#endif
// }
};
ASanPass(/*SanitizerKind::Address, */false);
Expand Down

0 comments on commit 63f4afb

Please sign in to comment.