summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/FrontendAction.cpp
diff options
context:
space:
mode:
authorDavid Blaikie <dblaikie@gmail.com>2014-08-10 17:03:42 +0000
committerDavid Blaikie <dblaikie@gmail.com>2014-08-10 17:03:42 +0000
commitf62d4e772d7ea782ed2335639bd3f9c5c7b217f1 (patch)
tree4248e6be17f2bfc11ab17e1e9ad467f3a5337c4d /clang/lib/Frontend/FrontendAction.cpp
parentdd0e1e8d14cc7388ae02b7d93373a9baa4db2aad (diff)
downloadbcm5719-llvm-f62d4e772d7ea782ed2335639bd3f9c5c7b217f1.tar.gz
bcm5719-llvm-f62d4e772d7ea782ed2335639bd3f9c5c7b217f1.zip
unique_ptr-ify FrontendAction::takeCurrentASTUnit
llvm-svn: 215319
Diffstat (limited to 'clang/lib/Frontend/FrontendAction.cpp')
-rw-r--r--clang/lib/Frontend/FrontendAction.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/clang/lib/Frontend/FrontendAction.cpp b/clang/lib/Frontend/FrontendAction.cpp
index cf13d7b9ba8..8295d6ddfa9 100644
--- a/clang/lib/Frontend/FrontendAction.cpp
+++ b/clang/lib/Frontend/FrontendAction.cpp
@@ -129,9 +129,9 @@ FrontendAction::FrontendAction() : Instance(nullptr) {}
FrontendAction::~FrontendAction() {}
void FrontendAction::setCurrentInput(const FrontendInputFile &CurrentInput,
- ASTUnit *AST) {
+ std::unique_ptr<ASTUnit> AST) {
this->CurrentInput = CurrentInput;
- CurrentASTUnit.reset(AST);
+ CurrentASTUnit = std::move(AST);
}
ASTConsumer* FrontendAction::CreateWrappedASTConsumer(CompilerInstance &CI,
@@ -189,13 +189,12 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
IntrusiveRefCntPtr<DiagnosticsEngine> Diags(&CI.getDiagnostics());
- ASTUnit *AST = ASTUnit::LoadFromASTFile(InputFile, Diags,
- CI.getFileSystemOpts());
+ std::unique_ptr<ASTUnit> AST(
+ ASTUnit::LoadFromASTFile(InputFile, Diags, CI.getFileSystemOpts()));
+
if (!AST)
goto failure;
- setCurrentInput(Input, AST);
-
// Inform the diagnostic client we are processing a source file.
CI.getDiagnosticClient().BeginSourceFile(CI.getLangOpts(), nullptr);
HasBegunSourceFile = true;
@@ -207,6 +206,8 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
CI.setPreprocessor(&AST->getPreprocessor());
CI.setASTContext(&AST->getASTContext());
+ setCurrentInput(Input, std::move(AST));
+
// Initialize the action.
if (!BeginSourceFileAction(CI, InputFile))
goto failure;
OpenPOWER on IntegriCloud