summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-12-02 21:47:43 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-12-02 21:47:43 +0000
commita18f9580e47269e63e197e74f4770ba5d8f6f1f2 (patch)
tree6c2ef655a8403031d96c3a8890e154cfb707f40a /clang/lib
parent4897349a7999777c75bf2e7f97389b481d3f9777 (diff)
downloadbcm5719-llvm-a18f9580e47269e63e197e74f4770ba5d8f6f1f2.tar.gz
bcm5719-llvm-a18f9580e47269e63e197e74f4770ba5d8f6f1f2.zip
ASTUnit: Explicitly track whether the ASTUnit came from an actual AST or not.
llvm-svn: 90349
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Frontend/ASTUnit.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/clang/lib/Frontend/ASTUnit.cpp b/clang/lib/Frontend/ASTUnit.cpp
index 6cbcb46e526..a3db339b83f 100644
--- a/clang/lib/Frontend/ASTUnit.cpp
+++ b/clang/lib/Frontend/ASTUnit.cpp
@@ -34,7 +34,10 @@
#include "llvm/System/Path.h"
using namespace clang;
-ASTUnit::ASTUnit(DiagnosticClient *diagClient) : tempFile(false) {
+ASTUnit::ASTUnit(bool _MainFileIsAST,
+ DiagnosticClient *diagClient)
+ : tempFile(false), MainFileIsAST(_MainFileIsAST)
+{
Diags.setClient(diagClient ? diagClient : new TextDiagnosticBuffer());
}
ASTUnit::~ASTUnit() {
@@ -99,7 +102,7 @@ const std::string &ASTUnit::getOriginalSourceFileName() {
}
const std::string &ASTUnit::getPCHFileName() {
- assert(Ctx->getExternalSource() && "Not an ASTUnit from a PCH file!");
+ assert(isMainFileAST() && "Not an ASTUnit from a PCH file!");
return dyn_cast<PCHReader>(Ctx->getExternalSource())->getFileName();
}
@@ -108,7 +111,7 @@ ASTUnit *ASTUnit::LoadFromPCHFile(const std::string &Filename,
DiagnosticClient *diagClient,
bool OnlyLocalDecls,
bool UseBumpAllocator) {
- llvm::OwningPtr<ASTUnit> AST(new ASTUnit(diagClient));
+ llvm::OwningPtr<ASTUnit> AST(new ASTUnit(true, diagClient));
AST->OnlyLocalDecls = OnlyLocalDecls;
AST->HeaderInfo.reset(new HeaderSearch(AST->getFileManager()));
@@ -230,7 +233,7 @@ ASTUnit *ASTUnit::LoadFromCompilerInvocation(const CompilerInvocation &CI,
// Create the AST unit.
//
// FIXME: Use the provided diagnostic client.
- AST.reset(new ASTUnit());
+ AST.reset(new ASTUnit(false));
AST->OnlyLocalDecls = OnlyLocalDecls;
AST->OriginalSourceFile = Clang.getFrontendOpts().Inputs[0].second;
OpenPOWER on IntegriCloud