From d3b74d9ca4f239a7a90ad193378c494306c57352 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Thu, 17 Nov 2011 23:01:24 +0000 Subject: Make 'LangOptions' in CompilerInvocation a heap-allocated, reference counted object. I discovered that llvm::RefCountedBase has a bug where the reference count is copied in the copy constructor, which means that there were cases when the CompilerInvocation objects created by ASTUnit were actually leaked. When I fixed that bug locally, it showed that a whole bunch of code assumed that the LangOptions object that was part of CompilerInvocation was still alive. By making it heap-allocated and reference counted, we can keep it around after the CompilerInvocation object goes away. As part of this change, change CompilerInvocation:getLangOptions() to return a pointer, acting as another clue that this object may outlive the CompilerInvocation object. This commit doesn't fix the CompilerInvocation leak itself. That will come when I commit the fix to llvm::RefCountedBase to mainline LLVM. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@144930 91177308-0d34-0410-b5e6-96231b3b80d8 --- tools/arcmt-test/arcmt-test.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tools/arcmt-test') diff --git a/tools/arcmt-test/arcmt-test.cpp b/tools/arcmt-test/arcmt-test.cpp index e47e815d35..3f91fcf124 100644 --- a/tools/arcmt-test/arcmt-test.cpp +++ b/tools/arcmt-test/arcmt-test.cpp @@ -125,7 +125,7 @@ static bool checkForMigration(StringRef resourcesPath, return true; } - if (!CI.getLangOpts().ObjC1) + if (!CI.getLangOpts()->ObjC1) return false; arcmt::checkForManualIssues(CI, @@ -167,13 +167,13 @@ static bool performTransformations(StringRef resourcesPath, return true; } - if (!origCI.getLangOpts().ObjC1) + if (!origCI.getLangOpts()->ObjC1) return false; MigrationProcess migration(origCI, DiagClient); std::vector - transforms = arcmt::getAllTransformations(origCI.getLangOpts().getGC()); + transforms = arcmt::getAllTransformations(origCI.getLangOpts()->getGC()); assert(!transforms.empty()); llvm::OwningPtr transformPrinter; -- cgit v1.2.3