diff options
Diffstat (limited to 'include/clang/Lex')
-rw-r--r-- | include/clang/Lex/PPCallbacks.h | 15 | ||||
-rw-r--r-- | include/clang/Lex/Preprocessor.h | 10 | ||||
-rw-r--r-- | include/clang/Lex/TokenConcatenation.h | 4 |
3 files changed, 23 insertions, 6 deletions
diff --git a/include/clang/Lex/PPCallbacks.h b/include/clang/Lex/PPCallbacks.h index e891e94..d74124e 100644 --- a/include/clang/Lex/PPCallbacks.h +++ b/include/clang/Lex/PPCallbacks.h @@ -44,6 +44,14 @@ public: SrcMgr::CharacteristicKind FileType) { } + /// FileSkipped - This callback is invoked whenever a source file is + /// skipped as the result of header guard optimization. ParentFile + /// is the file that #includes the skipped file. FilenameTok is the + /// token in ParentFile that indicates the skipped file. + virtual void FileSkipped(const FileEntry &ParentFile, + const Token &FilenameTok, + SrcMgr::CharacteristicKind FileType) { + } /// EndOfMainFile - This callback is invoked when the end of the main file is /// reach, no subsequent callbacks will be made. @@ -96,6 +104,13 @@ public: Second->FileChanged(Loc, Reason, FileType); } + virtual void FileSkipped(const FileEntry &ParentFile, + const Token &FilenameTok, + SrcMgr::CharacteristicKind FileType) { + First->FileSkipped(ParentFile, FilenameTok, FileType); + Second->FileSkipped(ParentFile, FilenameTok, FileType); + } + virtual void EndOfMainFile() { First->EndOfMainFile(); Second->EndOfMainFile(); diff --git a/include/clang/Lex/Preprocessor.h b/include/clang/Lex/Preprocessor.h index 312a760..20d9fc5 100644 --- a/include/clang/Lex/Preprocessor.h +++ b/include/clang/Lex/Preprocessor.h @@ -366,17 +366,17 @@ public: /// EnterMainSourceFile - Enter the specified FileID as the main source file, /// which implicitly adds the builtin defines etc. - bool EnterMainSourceFile(); + void EnterMainSourceFile(); /// EndSourceFile - Inform the preprocessor callbacks that processing is /// complete. void EndSourceFile(); /// EnterSourceFile - Add a source file to the top of the include stack and - /// start lexing tokens from it instead of the current buffer. Return true - /// and fill in ErrorStr with the error information on failure. - bool EnterSourceFile(FileID CurFileID, const DirectoryLookup *Dir, - std::string &ErrorStr); + /// start lexing tokens from it instead of the current buffer. Emit an error + /// and don't enter the file on error. + void EnterSourceFile(FileID CurFileID, const DirectoryLookup *Dir, + SourceLocation Loc); /// EnterMacro - Add a Macro to the top of the include stack and start lexing /// tokens from it instead of the current buffer. Args specifies the diff --git a/include/clang/Lex/TokenConcatenation.h b/include/clang/Lex/TokenConcatenation.h index d759e47..094990a 100644 --- a/include/clang/Lex/TokenConcatenation.h +++ b/include/clang/Lex/TokenConcatenation.h @@ -58,7 +58,9 @@ namespace clang { public: TokenConcatenation(Preprocessor &PP); - bool AvoidConcat(const Token &PrevTok, const Token &Tok) const; + bool AvoidConcat(const Token &PrevPrevTok, + const Token &PrevTok, + const Token &Tok) const; private: /// StartsWithL - Return true if the spelling of this token starts with 'L'. |