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 | 1a9ca21881cccf4b5f6aaccaf1dad576c133ab7a (patch) | |
tree | 449e356291d024d13e7b32bef8383a0f073585f2 /clang/lib/Frontend/PrintPreprocessedOutput.cpp | |
parent | 09f6823eb6438341a0ad78e44479bcafd27510ce (diff) | |
download | bcm5719-llvm-1a9ca21881cccf4b5f6aaccaf1dad576c133ab7a.tar.gz bcm5719-llvm-1a9ca21881cccf4b5f6aaccaf1dad576c133ab7a.zip |
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
llvm-svn: 119845
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r-- | clang/lib/Frontend/PrintPreprocessedOutput.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp index 429999cd5e3..7494bd3002e 100644 --- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/clang/lib/Frontend/PrintPreprocessedOutput.cpp @@ -147,11 +147,10 @@ public: void HandleNewlinesInToken(const char *TokStr, unsigned Len); /// MacroDefined - This hook is called whenever a macro definition is seen. - void MacroDefined(const IdentifierInfo *II, const MacroInfo *MI); + void MacroDefined(const Token &MacroNameTok, const MacroInfo *MI); /// MacroUndefined - This hook is called whenever a macro #undef is seen. - void MacroUndefined(SourceLocation Loc, const IdentifierInfo *II, - const MacroInfo *MI); + void MacroUndefined(const Token &MacroNameTok, const MacroInfo *MI); }; } // end anonymous namespace @@ -323,7 +322,7 @@ void PrintPPOutputPPCallbacks::Ident(SourceLocation Loc, const std::string &S) { } /// MacroDefined - This hook is called whenever a macro definition is seen. -void PrintPPOutputPPCallbacks::MacroDefined(const IdentifierInfo *II, +void PrintPPOutputPPCallbacks::MacroDefined(const Token &MacroNameTok, const MacroInfo *MI) { // Only print out macro definitions in -dD mode. if (!DumpDefines || @@ -331,18 +330,17 @@ void PrintPPOutputPPCallbacks::MacroDefined(const IdentifierInfo *II, MI->isBuiltinMacro()) return; MoveToLine(MI->getDefinitionLoc()); - PrintMacroDefinition(*II, *MI, PP, OS); + PrintMacroDefinition(*MacroNameTok.getIdentifierInfo(), *MI, PP, OS); EmittedMacroOnThisLine = true; } -void PrintPPOutputPPCallbacks::MacroUndefined(SourceLocation Loc, - const IdentifierInfo *II, +void PrintPPOutputPPCallbacks::MacroUndefined(const Token &MacroNameTok, const MacroInfo *MI) { // Only print out macro definitions in -dD mode. if (!DumpDefines) return; - MoveToLine(Loc); - OS << "#undef " << II->getName(); + MoveToLine(MacroNameTok.getLocation()); + OS << "#undef " << MacroNameTok.getIdentifierInfo()->getName(); EmittedMacroOnThisLine = true; } @@ -616,4 +614,3 @@ void clang::DoPrintPreprocessedInput(Preprocessor &PP, llvm::raw_ostream *OS, PrintPreprocessedTokens(PP, Tok, Callbacks, *OS); *OS << '\n'; } - |