summaryrefslogtreecommitdiffstats
path: root/clang/lib/Frontend/PrintPreprocessedOutput.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-08-07 22:27:00 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-08-07 22:27:00 +0000
commitd05f31d05932cf797292c94f40453004a9667670 (patch)
treef33b818f78820bccb1b37367e3003fd584adad1e /clang/lib/Frontend/PrintPreprocessedOutput.cpp
parent225801cd324a908f69b2c54cddd59c2aeed5582a (diff)
downloadbcm5719-llvm-d05f31d05932cf797292c94f40453004a9667670.tar.gz
bcm5719-llvm-d05f31d05932cf797292c94f40453004a9667670.zip
Push location through the MacroUndefined PPCallback and use it to print #undefs in -dD mode. (PR7818)
llvm-svn: 110523
Diffstat (limited to 'clang/lib/Frontend/PrintPreprocessedOutput.cpp')
-rw-r--r--clang/lib/Frontend/PrintPreprocessedOutput.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/clang/lib/Frontend/PrintPreprocessedOutput.cpp b/clang/lib/Frontend/PrintPreprocessedOutput.cpp
index 73bca9a6caa..e68fd583aa2 100644
--- a/clang/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/clang/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,
OpenPOWER on IntegriCloud