[preprocessor] Use MacroDirective in the preprocessor callbacks to make available the
full information about the macro (e.g if it was imported and where).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@175978 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/PrintPreprocessedOutput.cpp b/lib/Frontend/PrintPreprocessedOutput.cpp
index 3d55adc..58bbfd3 100644
--- a/lib/Frontend/PrintPreprocessedOutput.cpp
+++ b/lib/Frontend/PrintPreprocessedOutput.cpp
@@ -160,10 +160,10 @@
void HandleNewlinesInToken(const char *TokStr, unsigned Len);
/// MacroDefined - This hook is called whenever a macro definition is seen.
- void MacroDefined(const Token &MacroNameTok, const MacroInfo *MI);
+ void MacroDefined(const Token &MacroNameTok, const MacroDirective *MD);
/// MacroUndefined - This hook is called whenever a macro #undef is seen.
- void MacroUndefined(const Token &MacroNameTok, const MacroInfo *MI);
+ void MacroUndefined(const Token &MacroNameTok, const MacroDirective *MD);
};
} // end anonymous namespace
@@ -317,7 +317,8 @@
/// MacroDefined - This hook is called whenever a macro definition is seen.
void PrintPPOutputPPCallbacks::MacroDefined(const Token &MacroNameTok,
- const MacroInfo *MI) {
+ const MacroDirective *MD) {
+ const MacroInfo *MI = MD->getInfo();
// Only print out macro definitions in -dD mode.
if (!DumpDefines ||
// Ignore __FILE__ etc.
@@ -329,7 +330,7 @@
}
void PrintPPOutputPPCallbacks::MacroUndefined(const Token &MacroNameTok,
- const MacroInfo *MI) {
+ const MacroDirective *MD) {
// Only print out macro definitions in -dD mode.
if (!DumpDefines) return;