]> granicus.if.org Git - clang/commitdiff
Unique-pointerify these pointers an plug a memory leak.
authorAdrian Prantl <aprantl@apple.com>
Mon, 28 Sep 2015 23:56:10 +0000 (23:56 +0000)
committerAdrian Prantl <aprantl@apple.com>
Mon, 28 Sep 2015 23:56:10 +0000 (23:56 +0000)
Thanks to echristo for noticing!

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@248762 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/CodeGen/CodeGenABITypes.h
lib/CodeGen/CodeGenABITypes.cpp

index 2557f9c8e6f1918f7508ce1a51bd2f6cdd603479..455ad7458443625065eb14b80b2dacd1486c58a2 100644 (file)
@@ -52,7 +52,6 @@ class CodeGenABITypes
 public:
   CodeGenABITypes(ASTContext &C, llvm::Module &M,
                   CoverageSourceInfo *CoverageInfo = nullptr);
-  ~CodeGenABITypes();
 
   /// These methods all forward to methods in the private implementation class
   /// CodeGenTypes.
@@ -75,12 +74,12 @@ private:
   /// Default CodeGenOptions object used to initialize the
   /// CodeGenModule and otherwise not used. More specifically, it is
   /// not used in ABI type generation, so none of the options matter.
-  CodeGenOptions *CGO;
-  HeaderSearchOptions *HSO;
-  PreprocessorOptions *PPO;
+  std::unique_ptr<CodeGenOptions> CGO;
+  std::unique_ptr<HeaderSearchOptions> HSO;
+  std::unique_ptr<PreprocessorOptions> PPO;
 
   /// The CodeGenModule we use get to the CodeGenTypes object.
-  CodeGen::CodeGenModule *CGM;
+  std::unique_ptr<CodeGen::CodeGenModule> CGM;
 };
 
 }  // end namespace CodeGen
index 5305a29011a2fb6a9ed6ccfafa96e372c538fec1..b673fc2471781d1a760e74617d690e3e7a07fe56 100644 (file)
@@ -33,12 +33,6 @@ CodeGenABITypes::CodeGenABITypes(ASTContext &C, llvm::Module &M,
       CGM(new CodeGen::CodeGenModule(C, *HSO, *PPO, *CGO, M, C.getDiagnostics(),
                                      CoverageInfo)) {}
 
-CodeGenABITypes::~CodeGenABITypes()
-{
-  delete CGO;
-  delete CGM;
-}
-
 const CGFunctionInfo &
 CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,
                                                  QualType receiverType) {