r206471 - Since the object is new'ed in the enterCFG function, now deleting in the exitCFG function instead of the destructor to ensure proper pairing. This allows reuse of the builder without creating a memory leak.

Aaron Ballman aaron at aaronballman.com
Thu Apr 17 08:23:50 PDT 2014


Author: aaronballman
Date: Thu Apr 17 10:23:50 2014
New Revision: 206471

URL: http://llvm.org/viewvc/llvm-project?rev=206471&view=rev
Log:
Since the object is new'ed in the enterCFG function, now deleting in the exitCFG function instead of the destructor to ensure proper pairing. This allows reuse of the builder without creating a memory leak.

Modified:
    cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
    cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp

Modified: cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h?rev=206471&r1=206470&r2=206471&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h (original)
+++ cfe/trunk/include/clang/Analysis/Analyses/ThreadSafetyCommon.h Thu Apr 17 10:23:50 2014
@@ -227,10 +227,6 @@ public:
     SelfVar = new (Arena)til::Variable(til::Variable::VK_SFun);
   }
 
-  ~SExprBuilder() {
-    delete CallCtx;
-  }
-
   // Translate a clang statement or expression to a TIL expression.
   // Also performs substitution of variables; Ctx provides the context.
   // Dispatches on the type of S.

Modified: cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp?rev=206471&r1=206470&r2=206471&view=diff
==============================================================================
--- cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp (original)
+++ cfe/trunk/lib/Analysis/ThreadSafetyCommon.cpp Thu Apr 17 10:23:50 2014
@@ -597,6 +597,7 @@ void SExprBuilder::exitCFG(const CFGBloc
   CurrentBlockID = 0;
   CurrentVarID = 0;
   CurrentArgIndex = 0;
+  delete CallCtx;
 }
 
 





More information about the cfe-commits mailing list