[cfe-commits] r105578 - in /cfe/trunk: include/clang/Frontend/FrontendAction.h lib/Frontend/ASTUnit.cpp lib/Frontend/CompilerInstance.cpp lib/Frontend/FrontendAction.cpp
Daniel Dunbar
daniel at zuster.org
Mon Jun 7 16:23:06 PDT 2010
Author: ddunbar
Date: Mon Jun 7 18:23:06 2010
New Revision: 105578
URL: http://llvm.org/viewvc/llvm-project?rev=105578&view=rev
Log:
Frontend: Change FrontendAction::BeginSourceFile to take the input kind instead of an IsAST bool.
Modified:
cfe/trunk/include/clang/Frontend/FrontendAction.h
cfe/trunk/lib/Frontend/ASTUnit.cpp
cfe/trunk/lib/Frontend/CompilerInstance.cpp
cfe/trunk/lib/Frontend/FrontendAction.cpp
Modified: cfe/trunk/include/clang/Frontend/FrontendAction.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Frontend/FrontendAction.h?rev=105578&r1=105577&r2=105578&view=diff
==============================================================================
--- cfe/trunk/include/clang/Frontend/FrontendAction.h (original)
+++ cfe/trunk/include/clang/Frontend/FrontendAction.h Mon Jun 7 18:23:06 2010
@@ -166,17 +166,18 @@
/// \param Filename - The input filename, which will be made available to
/// clients via \see getCurrentFile().
///
- /// \param IsAST - Indicates whether this is an AST input. AST inputs require
- /// special handling, since the AST file itself contains several objects which
- /// would normally be owned by the CompilerInstance. When processing AST input
- /// files, these objects should generally not be initialized in the
- /// CompilerInstance -- they will automatically be shared with the AST file in
- /// between \see BeginSourceFile() and \see EndSourceFile().
+ /// \param InputKind - The type of input. Some input kinds are handled
+ /// specially, for example AST inputs, since the AST file itself contains
+ /// several objects which would normally be owned by the
+ /// CompilerInstance. When processing AST input files, these objects should
+ /// generally not be initialized in the CompilerInstance -- they will
+ /// automatically be shared with the AST file in between \see
+ /// BeginSourceFile() and \see EndSourceFile().
///
/// \return True on success; the compilation of this file should be aborted
/// and neither Execute nor EndSourceFile should be called.
bool BeginSourceFile(CompilerInstance &CI, llvm::StringRef Filename,
- bool IsAST = false);
+ InputKind Kind);
/// Execute - Set the source managers main input file, and run the action.
void Execute();
Modified: cfe/trunk/lib/Frontend/ASTUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/ASTUnit.cpp?rev=105578&r1=105577&r2=105578&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/ASTUnit.cpp (original)
+++ cfe/trunk/lib/Frontend/ASTUnit.cpp Mon Jun 7 18:23:06 2010
@@ -359,7 +359,7 @@
Act.reset(new TopLevelDeclTrackerAction(*AST));
if (!Act->BeginSourceFile(Clang, Clang.getFrontendOpts().Inputs[0].second,
- /*IsAST=*/false))
+ Clang.getFrontendOpts().Inputs[0].first))
goto error;
Act->Execute();
Modified: cfe/trunk/lib/Frontend/CompilerInstance.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/CompilerInstance.cpp?rev=105578&r1=105577&r2=105578&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/CompilerInstance.cpp (original)
+++ cfe/trunk/lib/Frontend/CompilerInstance.cpp Mon Jun 7 18:23:06 2010
@@ -509,7 +509,7 @@
createPreprocessor();
}
- if (Act.BeginSourceFile(*this, InFile, IsAST)) {
+ if (Act.BeginSourceFile(*this, InFile, getFrontendOpts().Inputs[i].first)) {
Act.Execute();
Act.EndSourceFile();
}
Modified: cfe/trunk/lib/Frontend/FrontendAction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Frontend/FrontendAction.cpp?rev=105578&r1=105577&r2=105578&view=diff
==============================================================================
--- cfe/trunk/lib/Frontend/FrontendAction.cpp (original)
+++ cfe/trunk/lib/Frontend/FrontendAction.cpp Mon Jun 7 18:23:06 2010
@@ -32,7 +32,7 @@
bool FrontendAction::BeginSourceFile(CompilerInstance &CI,
llvm::StringRef Filename,
- bool IsAST) {
+ InputKind InputKind) {
assert(!Instance && "Already processing a source file!");
assert(!Filename.empty() && "Unexpected empty filename!");
setCurrentFile(Filename);
@@ -40,6 +40,7 @@
// AST files follow a very different path, since they share objects via the
// AST unit.
+ bool IsAST = InputKind == IK_AST;
if (IsAST) {
assert(!usesPreprocessorOnly() &&
"Attempt to pass AST file to preprocessor only action!");
More information about the cfe-commits
mailing list