Bläddra i källkod

Unique-pointerify these pointers an plug a memory leak.
Thanks to echristo for noticing!

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

Adrian Prantl 10 år sedan
förälder
incheckning
b9651f741b
2 ändrade filer med 4 tillägg och 11 borttagningar
  1. 4 5
      include/clang/CodeGen/CodeGenABITypes.h
  2. 0 6
      lib/CodeGen/CodeGenABITypes.cpp

+ 4 - 5
include/clang/CodeGen/CodeGenABITypes.h

@@ -52,7 +52,6 @@ class CodeGenABITypes
 public:
 public:
   CodeGenABITypes(ASTContext &C, llvm::Module &M,
   CodeGenABITypes(ASTContext &C, llvm::Module &M,
                   CoverageSourceInfo *CoverageInfo = nullptr);
                   CoverageSourceInfo *CoverageInfo = nullptr);
-  ~CodeGenABITypes();
 
 
   /// These methods all forward to methods in the private implementation class
   /// These methods all forward to methods in the private implementation class
   /// CodeGenTypes.
   /// CodeGenTypes.
@@ -75,12 +74,12 @@ private:
   /// Default CodeGenOptions object used to initialize the
   /// Default CodeGenOptions object used to initialize the
   /// CodeGenModule and otherwise not used. More specifically, it is
   /// CodeGenModule and otherwise not used. More specifically, it is
   /// not used in ABI type generation, so none of the options matter.
   /// 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.
   /// The CodeGenModule we use get to the CodeGenTypes object.
-  CodeGen::CodeGenModule *CGM;
+  std::unique_ptr<CodeGen::CodeGenModule> CGM;
 };
 };
 
 
 }  // end namespace CodeGen
 }  // end namespace CodeGen

+ 0 - 6
lib/CodeGen/CodeGenABITypes.cpp

@@ -33,12 +33,6 @@ CodeGenABITypes::CodeGenABITypes(ASTContext &C, llvm::Module &M,
       CGM(new CodeGen::CodeGenModule(C, *HSO, *PPO, *CGO, M, C.getDiagnostics(),
       CGM(new CodeGen::CodeGenModule(C, *HSO, *PPO, *CGO, M, C.getDiagnostics(),
                                      CoverageInfo)) {}
                                      CoverageInfo)) {}
 
 
-CodeGenABITypes::~CodeGenABITypes()
-{
-  delete CGO;
-  delete CGM;
-}
-
 const CGFunctionInfo &
 const CGFunctionInfo &
 CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,
 CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD,
                                                  QualType receiverType) {
                                                  QualType receiverType) {