/// \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();
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);
// 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!");