diff options
author | Craig Silverstein <csilvers2000@yahoo.com> | 2010-11-19 21:33:15 +0000 |
---|---|---|
committer | Craig Silverstein <csilvers2000@yahoo.com> | 2010-11-19 21:33:15 +0000 |
commit | 2aa9267cf193e5eceb9fd24a51b51c031b606fe9 (patch) | |
tree | c82fdac0bd4e44ce6510051d02e146ec51bf4f00 /include | |
parent | e4539ef4633fa5c0867e247b5bc88e0f753a2336 (diff) |
Several PPCallbacks take an SourceLocation + IdentifierInfo, rather
than a Token that holds the same information all in one easy-to-use
package. There's no technical reason to prefer the former -- the
information comes from a Token originally -- and it's clumsier to use,
so I've changed the code to use tokens everywhere.
Approved by clattner
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@119845 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/clang/Lex/PPCallbacks.h | 42 | ||||
-rw-r--r-- | include/clang/Lex/PreprocessingRecord.h | 5 |
2 files changed, 22 insertions, 25 deletions
diff --git a/include/clang/Lex/PPCallbacks.h b/include/clang/Lex/PPCallbacks.h index 1946515302..fcfbc11c98 100644 --- a/include/clang/Lex/PPCallbacks.h +++ b/include/clang/Lex/PPCallbacks.h @@ -113,17 +113,16 @@ public: /// MacroExpands - This is called by /// Preprocessor::HandleMacroExpandedIdentifier when a macro invocation is /// found. - virtual void MacroExpands(const Token &Id, const MacroInfo* MI) { + virtual void MacroExpands(const Token &MacroNameTok, const MacroInfo* MI) { } /// MacroDefined - This hook is called whenever a macro definition is seen. - virtual void MacroDefined(const IdentifierInfo *II, const MacroInfo *MI) { + virtual void MacroDefined(const Token &MacroNameTok, const MacroInfo *MI) { } /// MacroUndefined - This hook is called whenever a macro #undef is seen. /// MI is released immediately following this callback. - virtual void MacroUndefined(SourceLocation Loc, const IdentifierInfo *II, - const MacroInfo *MI) { + virtual void MacroUndefined(const Token &MacroNameTok, const MacroInfo *MI) { } /// If -- This hook is called whenever an #if is seen. @@ -141,13 +140,13 @@ public: /// Ifdef -- This hook is called whenever an #ifdef is seen. /// \param Loc The location of the token being tested. /// \param II Information on the token being tested. - virtual void Ifdef(SourceLocation Loc, const IdentifierInfo* II) { + virtual void Ifdef(const Token &MacroNameTok) { } /// Ifndef -- This hook is called whenever an #ifndef is seen. /// \param Loc The location of the token being tested. /// \param II Information on the token being tested. - virtual void Ifndef(SourceLocation Loc, const IdentifierInfo* II) { + virtual void Ifndef(const Token &MacroNameTok) { } /// Else -- This hook is called whenever an #else is seen. @@ -205,20 +204,19 @@ public: Second->PragmaMessage(Loc, Str); } - virtual void MacroExpands(const Token &Id, const MacroInfo* MI) { - First->MacroExpands(Id, MI); - Second->MacroExpands(Id, MI); + virtual void MacroExpands(const Token &MacroNameTok, const MacroInfo* MI) { + First->MacroExpands(MacroNameTok, MI); + Second->MacroExpands(MacroNameTok, MI); } - virtual void MacroDefined(const IdentifierInfo *II, const MacroInfo *MI) { - First->MacroDefined(II, MI); - Second->MacroDefined(II, MI); + virtual void MacroDefined(const Token &MacroNameTok, const MacroInfo *MI) { + First->MacroDefined(MacroNameTok, MI); + Second->MacroDefined(MacroNameTok, MI); } - virtual void MacroUndefined(SourceLocation Loc, const IdentifierInfo *II, - const MacroInfo *MI) { - First->MacroUndefined(Loc, II, MI); - Second->MacroUndefined(Loc, II, MI); + virtual void MacroUndefined(const Token &MacroNameTok, const MacroInfo *MI) { + First->MacroUndefined(MacroNameTok, MI); + Second->MacroUndefined(MacroNameTok, MI); } /// If -- This hook is called whenever an #if is seen. @@ -234,15 +232,15 @@ public: } /// Ifdef -- This hook is called whenever an #ifdef is seen. - virtual void Ifdef(SourceLocation Loc, const IdentifierInfo* II) { - First->Ifdef(Loc, II); - Second->Ifdef(Loc, II); + virtual void Ifdef(const Token &MacroNameTok) { + First->Ifdef(MacroNameTok); + Second->Ifdef(MacroNameTok); } /// Ifndef -- This hook is called whenever an #ifndef is seen. - virtual void Ifndef(SourceLocation Loc, const IdentifierInfo* II) { - First->Ifndef(Loc, II); - Second->Ifndef(Loc, II); + virtual void Ifndef(const Token &MacroNameTok) { + First->Ifndef(MacroNameTok); + Second->Ifndef(MacroNameTok); } /// Else -- This hook is called whenever an #else is seen. diff --git a/include/clang/Lex/PreprocessingRecord.h b/include/clang/Lex/PreprocessingRecord.h index 69a2f18035..01ac79d3d4 100644 --- a/include/clang/Lex/PreprocessingRecord.h +++ b/include/clang/Lex/PreprocessingRecord.h @@ -325,9 +325,8 @@ namespace clang { MacroDefinition *findMacroDefinition(const MacroInfo *MI); virtual void MacroExpands(const Token &Id, const MacroInfo* MI); - virtual void MacroDefined(const IdentifierInfo *II, const MacroInfo *MI); - virtual void MacroUndefined(SourceLocation Loc, const IdentifierInfo *II, - const MacroInfo *MI); + virtual void MacroDefined(const Token &Id, const MacroInfo *MI); + virtual void MacroUndefined(const Token &Id, const MacroInfo *MI); virtual void InclusionDirective(SourceLocation HashLoc, const Token &IncludeTok, llvm::StringRef FileName, |