r342313 - [analyzer] Dump reproducible identifiers for statements in exploded graph in store
George Karpenkov via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 14 19:03:17 PDT 2018
Author: george.karpenkov
Date: Fri Sep 14 19:03:17 2018
New Revision: 342313
URL: http://llvm.org/viewvc/llvm-project?rev=342313&view=rev
Log:
[analyzer] Dump reproducible identifiers for statements in exploded graph in store
Differential Revision: https://reviews.llvm.org/D51826
Modified:
cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
Modified: cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h?rev=342313&r1=342312&r2=342313&view=diff
==============================================================================
--- cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h (original)
+++ cfe/trunk/include/clang/StaticAnalyzer/Core/PathSensitive/Environment.h Fri Sep 14 19:03:17 2018
@@ -93,6 +93,7 @@ public:
}
void print(raw_ostream &Out, const char *NL, const char *Sep,
+ const ASTContext &Context,
const LocationContext *WithLC = nullptr) const;
};
Modified: cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp?rev=342313&r1=342312&r2=342313&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/Environment.cpp Fri Sep 14 19:03:17 2018
@@ -202,7 +202,9 @@ EnvironmentManager::removeDeadBindings(E
}
void Environment::print(raw_ostream &Out, const char *NL,
- const char *Sep, const LocationContext *WithLC) const {
+ const char *Sep,
+ const ASTContext &Context,
+ const LocationContext *WithLC) const {
if (ExprBindings.isEmpty())
return;
@@ -222,8 +224,7 @@ void Environment::print(raw_ostream &Out
assert(WithLC);
- LangOptions LO; // FIXME.
- PrintingPolicy PP(LO);
+ PrintingPolicy PP = Context.getPrintingPolicy();
Out << NL << NL << "Expressions by stack frame:" << NL;
WithLC->dumpStack(Out, "", NL, Sep, [&](const LocationContext *LC) {
@@ -234,8 +235,9 @@ void Environment::print(raw_ostream &Out
const Stmt *S = I.first.getStmt();
assert(S != nullptr && "Expected non-null Stmt");
- Out << "(" << (const void *)LC << ',' << (const void *)S << ") ";
- S->printPretty(Out, nullptr, PP);
+ Out << "(LC" << (const void *)LC << ", S" << S->getID(Context) << " <"
+ << (const void *)S << "> ) ";
+ S->printPretty(Out, /*Helper=*/nullptr, PP);
Out << " : " << I.second << NL;
}
});
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp?rev=342313&r1=342312&r2=342313&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ExprEngine.cpp Fri Sep 14 19:03:17 2018
@@ -3109,7 +3109,7 @@ struct DOTGraphTraits<ExplodedNode*> : p
assert(S != nullptr && "Expecting non-null Stmt");
Out << S->getStmtClassName() << ' '
- << S->getID(Context) << " (" << (const void *)S << ") ";
+ << S->getID(Context) << " <" << (const void *)S << "> ";
S->printPretty(Out, /*helper=*/nullptr, Context.getPrintingPolicy(),
/*Indentation=*/2, /*NewlineSymbol=*/"\\l");
printLocation(Out, S->getBeginLoc());
@@ -3171,9 +3171,9 @@ struct DOTGraphTraits<ExplodedNode*> : p
static_cast<ExprEngine *>(State->getStateManager().getOwningEngine())
->getGraph();
- Out << "StateID: " << State->getID() << " (" << (const void *)State.get()
- << ")"
- << " NodeID: " << N->getID(&Graph) << " (" << (const void *)N << ")\\|";
+ Out << "StateID: " << State->getID() << " <" << (const void *)State.get()
+ << ">"
+ << " NodeID: " << N->getID(&Graph) << " <" << (const void *)N << ">\\|";
bool SameAsAllPredecessors =
std::all_of(N->pred_begin(), N->pred_end(), [&](const ExplodedNode *P) {
Modified: cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp?rev=342313&r1=342312&r2=342313&view=diff
==============================================================================
--- cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp (original)
+++ cfe/trunk/lib/StaticAnalyzer/Core/ProgramState.cpp Fri Sep 14 19:03:17 2018
@@ -456,14 +456,16 @@ void ProgramState::setStore(const StoreR
// State pretty-printing.
//===----------------------------------------------------------------------===//
-void ProgramState::print(raw_ostream &Out, const char *NL, const char *Sep,
+void ProgramState::print(raw_ostream &Out,
+ const char *NL, const char *Sep,
const LocationContext *LC) const {
// Print the store.
ProgramStateManager &Mgr = getStateManager();
+ const ASTContext &Context = getStateManager().getContext();
Mgr.getStoreManager().print(getStore(), Out, NL, Sep);
// Print out the environment.
- Env.print(Out, NL, Sep, LC);
+ Env.print(Out, NL, Sep, Context, LC);
// Print out the constraints.
Mgr.getConstraintManager().print(this, Out, NL, Sep);
@@ -478,7 +480,8 @@ void ProgramState::print(raw_ostream &Ou
Mgr.getOwningEngine()->printState(Out, this, NL, Sep, LC);
}
-void ProgramState::printDOT(raw_ostream &Out, const LocationContext *LC) const {
+void ProgramState::printDOT(raw_ostream &Out,
+ const LocationContext *LC) const {
print(Out, "\\l", "\\|", LC);
}
More information about the cfe-commits
mailing list