diff options
author | George Karpenkov <ekarpenkov@apple.com> | 2018-09-15 02:03:36 +0000 |
---|---|---|
committer | George Karpenkov <ekarpenkov@apple.com> | 2018-09-15 02:03:36 +0000 |
commit | 6bde7a015f12cb42e1669c6734969f3d897e92ed (patch) | |
tree | cc54cc6d0fb8ec6a317370b9155988fca4879918 /clang/lib | |
parent | fc042f95e2c93844fc1a48c75510139b4a626011 (diff) | |
download | bcm5719-llvm-6bde7a015f12cb42e1669c6734969f3d897e92ed.tar.gz bcm5719-llvm-6bde7a015f12cb42e1669c6734969f3d897e92ed.zip |
[analyzer] Generate and use stable identifiers for LocationContext
Those are not created in the allocator.
Since they are created fairly rarely, a counter overhead should not
affect the memory consumption.
Differential Revision: https://reviews.llvm.org/D51827
llvm-svn: 342314
Diffstat (limited to 'clang/lib')
-rw-r--r-- | clang/lib/Analysis/AnalysisDeclContext.cpp | 6 | ||||
-rw-r--r-- | clang/lib/StaticAnalyzer/Core/Environment.cpp | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/Analysis/AnalysisDeclContext.cpp b/clang/lib/Analysis/AnalysisDeclContext.cpp index 693fe066e14..30160bc239a 100644 --- a/clang/lib/Analysis/AnalysisDeclContext.cpp +++ b/clang/lib/Analysis/AnalysisDeclContext.cpp @@ -385,7 +385,7 @@ LocationContextManager::getLocationContext(AnalysisDeclContext *ctx, LOC *L = cast_or_null<LOC>(Contexts.FindNodeOrInsertPos(ID, InsertPos)); if (!L) { - L = new LOC(ctx, parent, d); + L = new LOC(ctx, parent, d, ++NewID); Contexts.InsertNode(L, InsertPos); } return L; @@ -402,7 +402,7 @@ LocationContextManager::getStackFrame(AnalysisDeclContext *ctx, auto *L = cast_or_null<StackFrameContext>(Contexts.FindNodeOrInsertPos(ID, InsertPos)); if (!L) { - L = new StackFrameContext(ctx, parent, s, blk, idx); + L = new StackFrameContext(ctx, parent, s, blk, idx, ++NewID); Contexts.InsertNode(L, InsertPos); } return L; @@ -427,7 +427,7 @@ LocationContextManager::getBlockInvocationContext(AnalysisDeclContext *ctx, cast_or_null<BlockInvocationContext>(Contexts.FindNodeOrInsertPos(ID, InsertPos)); if (!L) { - L = new BlockInvocationContext(ctx, parent, BD, ContextData); + L = new BlockInvocationContext(ctx, parent, BD, ContextData, ++NewID); Contexts.InsertNode(L, InsertPos); } return L; diff --git a/clang/lib/StaticAnalyzer/Core/Environment.cpp b/clang/lib/StaticAnalyzer/Core/Environment.cpp index 5f1a37c8d6c..4238ceb4ee6 100644 --- a/clang/lib/StaticAnalyzer/Core/Environment.cpp +++ b/clang/lib/StaticAnalyzer/Core/Environment.cpp @@ -235,8 +235,8 @@ void Environment::print(raw_ostream &Out, const char *NL, 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; } |