Author: adrian Date: Mon Sep 28 18:56:10 2015 New Revision: 248762 URL: http://llvm.org/viewvc/llvm-project?rev=248762&view=rev Log: Unique-pointerify these pointers an plug a memory leak. Thanks to echristo for noticing!
Modified: cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp Modified: cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h?rev=248762&r1=248761&r2=248762&view=diff ============================================================================== --- cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h (original) +++ cfe/trunk/include/clang/CodeGen/CodeGenABITypes.h Mon Sep 28 18:56:10 2015 @@ -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 Modified: cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp?rev=248762&r1=248761&r2=248762&view=diff ============================================================================== --- cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp (original) +++ cfe/trunk/lib/CodeGen/CodeGenABITypes.cpp Mon Sep 28 18:56:10 2015 @@ -33,12 +33,6 @@ CodeGenABITypes::CodeGenABITypes(ASTCont 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) { _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits