diff options
author | Daniel Dunbar <daniel@zuster.org> | 2010-06-07 23:25:49 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2010-06-07 23:25:49 +0000 |
commit | 685ac6665a3f91f9a66a9f44b6bf755a0cd929ea (patch) | |
tree | 902367d4f0cc31fb73882fae03efccee2242202b /lib/Frontend | |
parent | eb58d831b283a9fa030a2eccc6e23480108d2fa1 (diff) |
FrontendAction: Track active file kind.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@105581 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend')
-rw-r--r-- | lib/Frontend/ASTMerge.cpp | 3 | ||||
-rw-r--r-- | lib/Frontend/FrontendAction.cpp | 12 |
2 files changed, 9 insertions, 6 deletions
diff --git a/lib/Frontend/ASTMerge.cpp b/lib/Frontend/ASTMerge.cpp index 8118631d5c..e916e20065 100644 --- a/lib/Frontend/ASTMerge.cpp +++ b/lib/Frontend/ASTMerge.cpp @@ -26,7 +26,8 @@ bool ASTMergeAction::BeginSourceFileAction(CompilerInstance &CI, // FIXME: This is a hack. We need a better way to communicate the // AST file, compiler instance, and file name than member variables // of FrontendAction. - AdaptedAction->setCurrentFile(getCurrentFile(), takeCurrentASTUnit()); + AdaptedAction->setCurrentFile(getCurrentFile(), getCurrentFileKind(), + takeCurrentASTUnit()); AdaptedAction->setCompilerInstance(&CI); return AdaptedAction->BeginSourceFileAction(CI, Filename); } diff --git a/lib/Frontend/FrontendAction.cpp b/lib/Frontend/FrontendAction.cpp index 92137a6dc5..56676e1ef9 100644 --- a/lib/Frontend/FrontendAction.cpp +++ b/lib/Frontend/FrontendAction.cpp @@ -25,8 +25,10 @@ FrontendAction::FrontendAction() : Instance(0) {} FrontendAction::~FrontendAction() {} -void FrontendAction::setCurrentFile(llvm::StringRef Value, ASTUnit *AST) { +void FrontendAction::setCurrentFile(llvm::StringRef Value, InputKind Kind, + ASTUnit *AST) { CurrentFile = Value; + CurrentFileKind = Kind; CurrentASTUnit.reset(AST); } @@ -35,7 +37,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, InputKind InputKind) { assert(!Instance && "Already processing a source file!"); assert(!Filename.empty() && "Unexpected empty filename!"); - setCurrentFile(Filename); + setCurrentFile(Filename, InputKind); setCompilerInstance(&CI); // AST files follow a very different path, since they share objects via the @@ -52,7 +54,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, if (!AST) goto failure; - setCurrentFile(Filename, AST); + setCurrentFile(Filename, InputKind, AST); // Set the shared objects, these are reset when we finish processing the // file, otherwise the CompilerInstance will happily destroy them. @@ -127,7 +129,7 @@ bool FrontendAction::BeginSourceFile(CompilerInstance &CI, } CI.getDiagnosticClient().EndSourceFile(); - setCurrentFile(""); + setCurrentFile("", IK_None); setCompilerInstance(0); return false; } @@ -206,7 +208,7 @@ void FrontendAction::EndSourceFile() { } setCompilerInstance(0); - setCurrentFile(""); + setCurrentFile("", IK_None); } //===----------------------------------------------------------------------===// |