diff options
Diffstat (limited to 'clang/include/clang/Lex/PPCallbacks.h')
-rw-r--r-- | clang/include/clang/Lex/PPCallbacks.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/clang/include/clang/Lex/PPCallbacks.h b/clang/include/clang/Lex/PPCallbacks.h index de5e8eb2ca22..bcf49c577735 100644 --- a/clang/include/clang/Lex/PPCallbacks.h +++ b/clang/include/clang/Lex/PPCallbacks.h @@ -191,6 +191,10 @@ public: StringRef Str) { } + /// Callback invoked when a \#pragma mark comment is read. + virtual void PragmaMark(SourceLocation Loc, StringRef Trivia) { + } + /// Callback invoked when a \#pragma detect_mismatch directive is /// read. virtual void PragmaDetectMismatch(SourceLocation Loc, StringRef Name, @@ -351,6 +355,22 @@ public: const MacroDefinition &MD) { } + /// Hook called whenever an \#elifdef branch is taken. + /// \param Loc the source location of the directive. + /// \param MacroNameTok Information on the token being tested. + /// \param MD The MacroDefinition if the name was a macro, null otherwise. + virtual void Elifdef(SourceLocation Loc, const Token &MacroNameTok, + const MacroDefinition &MD) { + } + /// Hook called whenever an \#elifdef is skipped. + /// \param Loc the source location of the directive. + /// \param ConditionRange The SourceRange of the expression being tested. + /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive. + // FIXME: better to pass in a list (or tree!) of Tokens. + virtual void Elifdef(SourceLocation Loc, SourceRange ConditionRange, + SourceLocation IfLoc) { + } + /// Hook called whenever an \#ifndef is seen. /// \param Loc the source location of the directive. /// \param MacroNameTok Information on the token being tested. @@ -359,6 +379,22 @@ public: const MacroDefinition &MD) { } + /// Hook called whenever an \#elifndef branch is taken. + /// \param Loc the source location of the directive. + /// \param MacroNameTok Information on the token being tested. + /// \param MD The MacroDefinition if the name was a macro, null otherwise. + virtual void Elifndef(SourceLocation Loc, const Token &MacroNameTok, + const MacroDefinition &MD) { + } + /// Hook called whenever an \#elifndef is skipped. + /// \param Loc the source location of the directive. + /// \param ConditionRange The SourceRange of the expression being tested. + /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive. + // FIXME: better to pass in a list (or tree!) of Tokens. + virtual void Elifndef(SourceLocation Loc, SourceRange ConditionRange, + SourceLocation IfLoc) { + } + /// Hook called whenever an \#else is seen. /// \param Loc the source location of the directive. /// \param IfLoc the source location of the \#if/\#ifdef/\#ifndef directive. @@ -586,6 +622,19 @@ public: Second->Ifdef(Loc, MacroNameTok, MD); } + /// Hook called whenever an \#elifdef is taken. + void Elifdef(SourceLocation Loc, const Token &MacroNameTok, + const MacroDefinition &MD) override { + First->Elifdef(Loc, MacroNameTok, MD); + Second->Elifdef(Loc, MacroNameTok, MD); + } + /// Hook called whenever an \#elifdef is skipped. + void Elifdef(SourceLocation Loc, SourceRange ConditionRange, + SourceLocation IfLoc) override { + First->Elifdef(Loc, ConditionRange, IfLoc); + Second->Elifdef(Loc, ConditionRange, IfLoc); + } + /// Hook called whenever an \#ifndef is seen. void Ifndef(SourceLocation Loc, const Token &MacroNameTok, const MacroDefinition &MD) override { @@ -593,6 +642,19 @@ public: Second->Ifndef(Loc, MacroNameTok, MD); } + /// Hook called whenever an \#elifndef is taken. + void Elifndef(SourceLocation Loc, const Token &MacroNameTok, + const MacroDefinition &MD) override { + First->Elifndef(Loc, MacroNameTok, MD); + Second->Elifndef(Loc, MacroNameTok, MD); + } + /// Hook called whenever an \#elifndef is skipped. + void Elifndef(SourceLocation Loc, SourceRange ConditionRange, + SourceLocation IfLoc) override { + First->Elifndef(Loc, ConditionRange, IfLoc); + Second->Elifndef(Loc, ConditionRange, IfLoc); + } + /// Hook called whenever an \#else is seen. void Else(SourceLocation Loc, SourceLocation IfLoc) override { First->Else(Loc, IfLoc); |