diff options
author | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-07 22:27:00 +0000 |
---|---|---|
committer | Benjamin Kramer <benny.kra@googlemail.com> | 2010-08-07 22:27:00 +0000 |
commit | 2f05449fa1c9015a84b74c3308b856fc704662be (patch) | |
tree | 37627fef879142411d2e3dce1da7e5d817afef22 /lib/Frontend/PrintPreprocessedOutput.cpp | |
parent | 443c21266f189ed48c32cadf72c463e9b992b3eb (diff) |
Push location through the MacroUndefined PPCallback and use it to print #undefs in -dD mode. (PR7818)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@110523 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r-- | lib/Frontend/PrintPreprocessedOutput.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp index 73bca9a6ca..e68fd583aa 100644 --- a/lib/Frontend/PrintPreprocessedOutput.cpp +++ b/lib/Frontend/PrintPreprocessedOutput.cpp @@ -137,6 +137,9 @@ public: /// MacroDefined - This hook is called whenever a macro definition is seen. void MacroDefined(const IdentifierInfo *II, const MacroInfo *MI); + /// MacroUndefined - This hook is called whenever a macro #undef is seen. + void MacroUndefined(SourceLocation Loc, const IdentifierInfo *II, + const MacroInfo *MI); }; } // end anonymous namespace @@ -280,6 +283,16 @@ void PrintPPOutputPPCallbacks::MacroDefined(const IdentifierInfo *II, EmittedMacroOnThisLine = true; } +void PrintPPOutputPPCallbacks::MacroUndefined(SourceLocation Loc, + const IdentifierInfo *II, + const MacroInfo *MI) { + // Only print out macro definitions in -dD mode. + if (!DumpDefines) return; + + MoveToLine(Loc); + OS << "#undef " << II->getName(); + EmittedMacroOnThisLine = true; +} void PrintPPOutputPPCallbacks::PragmaComment(SourceLocation Loc, const IdentifierInfo *Kind, |