From 6bde7a015f12cb42e1669c6734969f3d897e92ed Mon Sep 17 00:00:00 2001 From: George Karpenkov Date: Sat, 15 Sep 2018 02:03:36 +0000 Subject: [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 --- clang/lib/Analysis/AnalysisDeclContext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'clang/lib/Analysis') 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(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(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(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; -- cgit v1.2.3