Skip to content

Instantly share code, notes, and snippets.

@zeroomega
Created June 23, 2017 19:24
Show Gist options
  • Save zeroomega/bbe2cfa298a912a1b5b37fa4b9cd76b5 to your computer and use it in GitHub Desktop.
Save zeroomega/bbe2cfa298a912a1b5b37fa4b9cd76b5 to your computer and use it in GitHub Desktop.
diff --git a/lib/StaticAnalyzer/Core/ExprEngine.cpp b/lib/StaticAnalyzer/Core/ExprEngine.cpp
index f84c0ee800..6ceba582f4 100644
--- a/lib/StaticAnalyzer/Core/ExprEngine.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngine.cpp
@@ -1516,6 +1516,11 @@ void ExprEngine::processCFGBlockEntrance(const BlockEdge &L,
// FIXME: Refactor this into a checker.
if (BlockCount >= AMgr.options.maxBlockVisitOnPath) {
static SimpleProgramPointTag tag(TagProviderName, "Block count exceeded");
+ llvm::errs()<<"Block Count exceeded maxBlockVisitOnPath "<<AMgr.options.maxBlockVisitOnPath<<"Dump SRC\n";
+ L.getSrc()->dump();
+ llvm::errs()<<"\n Dump Dst:\n";
+ L.getDst()->dump();
+ llvm::errs()<<"\n";
const ExplodedNode *Sink =
nodeBuilder.generateSink(Pred->getState(), Pred, &tag);
diff --git a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
index caf86b26b6..24f9ca3f64 100644
--- a/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
+++ b/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp
@@ -902,37 +902,52 @@ void ExprEngine::defaultEvalCall(NodeBuilder &Bldr, ExplodedNode *Pred,
// The origin expression here is just used as a kind of checksum;
// this should still be safe even for CallEvents that don't come from exprs.
const Expr *E = Call->getOriginExpr();
-
+ SourceLocation SL = E->getExprLoc();
+ SourceManager &SMgr = getBugReporter().getSourceManager();
+ SL.print(llvm::errs(), SMgr);
+ const FunctionDecl * FD = dyn_cast<CallExpr>(E)->getDirectCallee();
+ if (FD) {
+ StringRef Name = FD->getName();
+ llvm::errs()<<Name<<" ";
+ }
ProgramStateRef InlinedFailedState = getInlineFailedState(State, E);
if (InlinedFailedState) {
// If we already tried once and failed, make sure we don't retry later.
+ llvm::errs()<<" InlinedFailedState is not null ";
State = InlinedFailedState;
} else {
RuntimeDefinition RD = Call->getRuntimeDefinition();
const Decl *D = RD.getDecl();
if (shouldInlineCall(*Call, D, Pred)) {
+ llvm::errs()<<" Should inline: ";
if (RD.mayHaveOtherDefinitions()) {
AnalyzerOptions &Options = getAnalysisManager().options;
// Explore with and without inlining the call.
if (Options.getIPAMode() == IPAK_DynamicDispatchBifurcate) {
+ llvm::errs()<<" Bifurcate \n";
BifurcateCall(RD.getDispatchRegion(), *Call, D, Bldr, Pred);
return;
}
// Don't inline if we're not in any dynamic dispatch mode.
if (Options.getIPAMode() != IPAK_DynamicDispatch) {
+ llvm::errs()<<" Dynamic \n";
conservativeEvalCall(*Call, Bldr, Pred, State);
return;
}
}
// We are not bifurcating and we do have a Decl, so just inline.
- if (inlineCall(*Call, D, Bldr, Pred, State))
+ if (inlineCall(*Call, D, Bldr, Pred, State)) {
+ llvm::errs()<<"Direct inlined\n";
return;
+ } else {
+ llvm::errs()<<"Direct inline failed\n";
+ }
}
}
-
+ llvm::errs()<<" Should not inline \n";
// If we can't inline it, handle the return value and invalidate the regions.
conservativeEvalCall(*Call, Bldr, Pred, State);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment