diff options
| author | Daniel Dunbar <daniel@zuster.org> | 2010-02-16 01:54:54 +0000 |
|---|---|---|
| committer | Daniel Dunbar <daniel@zuster.org> | 2010-02-16 01:54:54 +0000 |
| commit | 7f21a7f7ce86b83fc7d96aef70f644b3392cef78 (patch) | |
| tree | 5ae02f9cb0bd61aa773cdda02894cd5d557e4cf3 /clang/lib | |
| parent | e922d9bdf0496bcc6615639535cb14e328c4ffee (diff) | |
| download | bcm5719-llvm-7f21a7f7ce86b83fc7d96aef70f644b3392cef78.tar.gz bcm5719-llvm-7f21a7f7ce86b83fc7d96aef70f644b3392cef78.zip | |
ASTUnit::LoadFromCompilerInvocation - Take ownership of the provided invocation.
llvm-svn: 96315
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Frontend/ASTUnit.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp index 7f1e722f32c..845b4cd5a69 100644 --- a/clang/lib/Frontend/ASTUnit.cpp +++ b/clang/lib/Frontend/ASTUnit.cpp @@ -230,7 +230,7 @@ public: } -ASTUnit *ASTUnit::LoadFromCompilerInvocation(const CompilerInvocation &CI, +ASTUnit *ASTUnit::LoadFromCompilerInvocation(CompilerInvocation *CI, Diagnostic &Diags, bool OnlyLocalDecls) { // Create the compiler instance to use for building the AST. @@ -238,7 +238,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(const CompilerInvocation &CI, llvm::OwningPtr<ASTUnit> AST; llvm::OwningPtr<TopLevelDeclTrackerAction> Act; - Clang.setInvocation(const_cast<CompilerInvocation*>(&CI)); + Clang.setInvocation(CI); Clang.setDiagnostics(&Diags); Clang.setDiagnosticClient(Diags.getClient()); @@ -296,6 +296,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(const CompilerInvocation &CI, Clang.takeDiagnostics(); Clang.takeInvocation(); + AST->Invocation.reset(Clang.takeInvocation()); return AST.take(); error: @@ -364,9 +365,5 @@ ASTUnit *ASTUnit::LoadFromCommandLine(const char **ArgBegin, CI->getHeaderSearchOpts().ResourceDir = ResourceFilesPath; CI->getFrontendOpts().DisableFree = UseBumpAllocator; - ASTUnit *Unit = LoadFromCompilerInvocation(*CI, Diags, OnlyLocalDecls); - if (Unit) - Unit->Invocation.reset(CI.take()); - - return Unit; + return LoadFromCompilerInvocation(CI.take(), Diags, OnlyLocalDecls); } |

