Index: clang/include/clang/Analysis/AnalysisDeclContext.h =================================================================== --- clang/include/clang/Analysis/AnalysisDeclContext.h +++ clang/include/clang/Analysis/AnalysisDeclContext.h @@ -230,17 +230,23 @@ AnalysisDeclContext *Ctx; const LocationContext *Parent; + int64_t ID; + static int64_t NewID; protected: LocationContext(ContextKind k, AnalysisDeclContext *ctx, const LocationContext *parent) - : Kind(k), Ctx(ctx), Parent(parent) {} + : Kind(k), Ctx(ctx), Parent(parent), ID(++NewID) {} public: virtual ~LocationContext(); ContextKind getKind() const { return Kind; } + int64_t getID() const { + return ID; + } + AnalysisDeclContext *getAnalysisDeclContext() const { return Ctx; } const LocationContext *getParent() const { return Parent; } Index: clang/lib/Analysis/AnalysisDeclContext.cpp =================================================================== --- clang/lib/Analysis/AnalysisDeclContext.cpp +++ clang/lib/Analysis/AnalysisDeclContext.cpp @@ -524,6 +524,8 @@ dumpStack(llvm::errs()); } +int64_t LocationContext::NewID = 0; + //===----------------------------------------------------------------------===// // Lazily generated map to query the external variables referenced by a Block. //===----------------------------------------------------------------------===// Index: clang/lib/StaticAnalyzer/Core/Environment.cpp =================================================================== --- clang/lib/StaticAnalyzer/Core/Environment.cpp +++ clang/lib/StaticAnalyzer/Core/Environment.cpp @@ -235,8 +235,8 @@ const Stmt *S = I.first.getStmt(); assert(S != nullptr && "Expected non-null Stmt"); - Out << "(LC" << (const void *)LC << ", S" << S->getID(Context) << " <" - << (const void *)S << "> ) "; + Out << "(LC " << LC->getID() << " <" << (const void *)LC << ">, S " + << S->getID(Context) << " <" << (const void *)S << ">) "; S->printPretty(Out, /*Helper=*/nullptr, PP); Out << " : " << I.second << NL; }