summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Prantl <aprantl@apple.com>2015-09-28 23:56:10 +0000
committerAdrian Prantl <aprantl@apple.com>2015-09-28 23:56:10 +0000
commit525c013921e98a89ebcc0e3ee57300cd6d1a2963 (patch)
treea33e69a3229e5167434bbb691b6a0b3e32f95e6f
parenta8173bad4e2afe1d21cc457947b58f91dd148792 (diff)
downloadbcm5719-llvm-525c013921e98a89ebcc0e3ee57300cd6d1a2963.tar.gz
bcm5719-llvm-525c013921e98a89ebcc0e3ee57300cd6d1a2963.zip
Unique-pointerify these pointers an plug a memory leak.
Thanks to echristo for noticing! llvm-svn: 248762
-rw-r--r--clang/include/clang/CodeGen/CodeGenABITypes.h9
-rw-r--r--clang/lib/CodeGen/CodeGenABITypes.cpp6
2 files changed, 4 insertions, 11 deletions
diff --git a/clang/include/clang/CodeGen/CodeGenABITypes.h b/clang/include/clang/CodeGen/CodeGenABITypes.h
index 2557f9c8e6f..455ad745844 100644
--- a/clang/include/clang/CodeGen/CodeGenABITypes.h
+++ b/clang/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<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
diff --git a/clang/lib/CodeGen/CodeGenABITypes.cpp b/clang/lib/CodeGen/CodeGenABITypes.cpp
index 5305a29011a..b673fc24717 100644
--- a/clang/lib/CodeGen/CodeGenABITypes.cpp
+++ b/clang/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) {
OpenPOWER on IntegriCloud