summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/CompilerInstance.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2017-01-06 17:47:10 +0000
committerDavid Blaikie <dblaikie@gmail.com>2017-01-06 17:47:10 +0000
commit81d08294384d968ebbc2d0584d1b987f1a8a01b3 (patch)
treef74908be6ffd56b83252c5430c5b855be2f10c1e /clang/lib/Frontend/CompilerInstance.cpp
parent3128d6b520c7c43dacd6efb60464ba5318e88feb (diff)
downloadbcm5719-llvm-81d08294384d968ebbc2d0584d1b987f1a8a01b3.tar.gz
bcm5719-llvm-81d08294384d968ebbc2d0584d1b987f1a8a01b3.zip
Revert "IntrusiveRefCntPtr -> std::shared_ptr for CompilerInvocationBase and CodeCompleteConsumer"
Caused a memory leak reported by asan. Reverting while I investigate. This reverts commit r291184. llvm-svn: 291249
Diffstat (limited to 'clang/lib/Frontend/CompilerInstance.cpp')
-rw-r--r--clang/lib/Frontend/CompilerInstance.cpp14
1 files changed, 6 insertions, 8 deletions
diff --git a/clang/lib/Frontend/CompilerInstance.cpp b/clang/lib/Frontend/CompilerInstance.cpp
index afcaa6e8787..6f39d48f596 100644
--- a/clang/lib/Frontend/CompilerInstance.cpp
+++ b/clang/lib/Frontend/CompilerInstance.cpp
@@ -66,9 +66,8 @@ CompilerInstance::~CompilerInstance() {
assert(OutputFiles.empty() && "Still output files in flight?");
}
-void CompilerInstance::setInvocation(
- std::shared_ptr<CompilerInvocation> Value) {
- Invocation = std::move(Value);
+void CompilerInstance::setInvocation(CompilerInvocation *Value) {
+ Invocation = Value;
}
bool CompilerInstance::shouldBuildGlobalModuleIndex() const {
@@ -1020,8 +1019,8 @@ static bool compileModuleImpl(CompilerInstance &ImportingInstance,
= ImportingInstance.getPreprocessor().getHeaderSearchInfo().getModuleMap();
// Construct a compiler invocation for creating this module.
- auto Invocation =
- std::make_shared<CompilerInvocation>(ImportingInstance.getInvocation());
+ IntrusiveRefCntPtr<CompilerInvocation> Invocation
+ (new CompilerInvocation(ImportingInstance.getInvocation()));
PreprocessorOptions &PPOpts = Invocation->getPreprocessorOpts();
@@ -1077,8 +1076,7 @@ static bool compileModuleImpl(CompilerInstance &ImportingInstance,
// module.
CompilerInstance Instance(ImportingInstance.getPCHContainerOperations(),
/*BuildingModule=*/true);
- auto &Inv = *Invocation;
- Instance.setInvocation(std::move(Invocation));
+ Instance.setInvocation(&*Invocation);
Instance.createDiagnostics(new ForwardingDiagnosticConsumer(
ImportingInstance.getDiagnosticClient()),
@@ -1100,7 +1098,7 @@ static bool compileModuleImpl(CompilerInstance &ImportingInstance,
// between all of the module CompilerInstances. Other than that, we don't
// want to produce any dependency output from the module build.
Instance.setModuleDepCollector(ImportingInstance.getModuleDepCollector());
- Inv.getDependencyOutputOpts() = DependencyOutputOptions();
+ Invocation->getDependencyOutputOpts() = DependencyOutputOptions();
// Get or create the module map that we'll use to build this module.
std::string InferredModuleMapContent;
OpenPOWER on IntegriCloud