From: Adrian Prantl Date: Mon, 28 Sep 2015 23:56:10 +0000 (+0000) Subject: Unique-pointerify these pointers an plug a memory leak. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b9651f741bb20dc3f670a65a06a41ec095434ad0;p=clang 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 --- diff --git a/include/clang/CodeGen/CodeGenABITypes.h b/include/clang/CodeGen/CodeGenABITypes.h index 2557f9c8e6..455ad74584 100644 --- a/include/clang/CodeGen/CodeGenABITypes.h +++ b/include/clang/CodeGen/CodeGenABITypes.h @@ -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 CGO; + std::unique_ptr HSO; + std::unique_ptr PPO; /// The CodeGenModule we use get to the CodeGenTypes object. - CodeGen::CodeGenModule *CGM; + std::unique_ptr CGM; }; } // end namespace CodeGen diff --git a/lib/CodeGen/CodeGenABITypes.cpp b/lib/CodeGen/CodeGenABITypes.cpp index 5305a29011..b673fc2471 100644 --- a/lib/CodeGen/CodeGenABITypes.cpp +++ b/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(), CoverageInfo)) {} -CodeGenABITypes::~CodeGenABITypes() -{ - delete CGO; - delete CGM; -} - const CGFunctionInfo & CodeGenABITypes::arrangeObjCMessageSendSignature(const ObjCMethodDecl *MD, QualType receiverType) {