summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index 3535276e6e9..791017924d6 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -134,10 +134,9 @@ void FrontendAction::setCurrentInput(const FrontendInputFile &CurrentInput,
CurrentASTUnit.reset(AST);
}
-std::unique_ptr<ASTConsumer>
-FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
- std::unique_ptr<ASTConsumer> Consumer = CreateASTConsumer(CI, InFile);
+ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
+ StringRef InFile) {
+ ASTConsumer* Consumer = CreateASTConsumer(CI, InFile);
if (!Consumer)
return nullptr;
@@ -146,8 +145,7 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
// Make sure the non-plugin consumer is first, so that plugins can't
// modifiy the AST.
- std::vector<std::unique_ptr<ASTConsumer>> Consumers;
- Consumers.push_back(std::move(Consumer));
+ std::vector<ASTConsumer*> Consumers(1, Consumer);
for (size_t i = 0, e = CI.getFrontendOpts().AddPluginActions.size();
i != e; ++i) {
@@ -157,15 +155,16 @@ FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
it = FrontendPluginRegistry::begin(),
ie = FrontendPluginRegistry::end();
it != ie; ++it) {
- if (it->getName() != CI.getFrontendOpts().AddPluginActions[i])
- continue;
- std::unique_ptr<PluginASTAction> P = it->instantiate();
- if (P->ParseArgs(CI, CI.getFrontendOpts().AddPluginArgs[i]))
- Consumers.push_back(P->CreateASTConsumer(CI, InFile));
+ if (it->getName() == CI.getFrontendOpts().AddPluginActions[i]) {
+ std::unique_ptr<PluginASTAction> P(it->instantiate());
+ FrontendAction* c = P.get();
+ if (P->ParseArgs(CI, CI.getFrontendOpts().AddPluginArgs[i]))
+ Consumers.push_back(c->CreateASTConsumer(CI, InFile));
+ }
}
}
- return llvm::make_unique<MultiplexConsumer>(std::move(Consumers));
+ return new MultiplexConsumer(Consumers);
}
bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
@@ -308,8 +307,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
if (!usesPreprocessorOnly()) {
CI.createASTContext();
- std::unique_ptr<ASTConsumer> Consumer =
- CreateWrappedASTConsumer(CI, InputFile);
+ std::unique_ptr<ASTConsumer> Consumer(
+ CreateWrappedASTConsumer(CI, InputFile));
if (!Consumer)
goto failure;
@@ -350,7 +349,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
goto failure;
}
- CI.setASTConsumer(std::move(Consumer));
+ CI.setASTConsumer(Consumer.release());
if (!CI.hasASTConsumer())
goto failure;
}
@@ -445,7 +444,7 @@ void FrontendAction::EndSourceFile() {
CI.resetAndLeakSema();
CI.resetAndLeakASTContext();
}
- BuryPointer(CI.takeASTConsumer().get());
+ BuryPointer(CI.takeASTConsumer());
} else {
if (!isCurrentFileAST()) {
CI.setSema(nullptr);
@@ -517,15 +516,14 @@ void ASTFrontendAction::ExecuteAction() {
void PluginASTAction::anchor() { }
-std::unique_ptr<ASTConsumer>
+ASTConsumer *
PreprocessorFrontendAction::CreateASTConsumer(CompilerInstance &CI,
StringRef InFile) {
llvm_unreachable("Invalid CreateASTConsumer on preprocessor action!");
}
-std::unique_ptr<ASTConsumer>
-WrapperFrontendAction::CreateASTConsumer(CompilerInstance &CI,
- StringRef InFile) {
+ASTConsumer *WrapperFrontendAction::CreateASTConsumer(CompilerInstance &CI,
+ StringRef InFile) {
return WrappedAction->CreateASTConsumer(CI, InFile);
}
bool WrapperFrontendAction::BeginInvocation(CompilerInstance &CI) {
OpenPOWER on IntegriCloud