[cfe-commits] r68883 - in /cfe/trunk: include/clang/Lex/PPCallbacks.h lib/Lex/PPDirectives.cpp
Chris Lattner
sabre at nondot.org
Sat Apr 11 18:40:01 PDT 2009
Author: lattner
Date: Sat Apr 11 20:39:54 2009
New Revision: 68883
URL: http://llvm.org/viewvc/llvm-project?rev=68883&view=rev
Log:
add a ppcallback hook for macro definitions.
Modified:
cfe/trunk/include/clang/Lex/PPCallbacks.h
cfe/trunk/lib/Lex/PPDirectives.cpp
Modified: cfe/trunk/include/clang/Lex/PPCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Lex/PPCallbacks.h?rev=68883&r1=68882&r2=68883&view=diff
==============================================================================
--- cfe/trunk/include/clang/Lex/PPCallbacks.h (original)
+++ cfe/trunk/include/clang/Lex/PPCallbacks.h Sat Apr 11 20:39:54 2009
@@ -55,10 +55,15 @@
const std::string &Str) {
}
- /// MacroExpands - This is called Preprocessor::HandleMacroExpandedIdentifier
- /// when a macro invocation is found.
+ /// MacroExpands - This is called by
+ /// Preprocessor::HandleMacroExpandedIdentifier when a macro invocation is
+ /// found.
virtual void MacroExpands(const Token &Id, const MacroInfo* MI) {
}
+
+ /// MacroDefined - This hook is called whenever a macro definition is seen.
+ virtual void MacroDefined(const IdentifierInfo *II, const MacroInfo *MI) {
+ }
};
} // end namespace clang
Modified: cfe/trunk/lib/Lex/PPDirectives.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPDirectives.cpp?rev=68883&r1=68882&r2=68883&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPDirectives.cpp (original)
+++ cfe/trunk/lib/Lex/PPDirectives.cpp Sat Apr 11 20:39:54 2009
@@ -1402,6 +1402,10 @@
}
setMacroInfo(MacroNameTok.getIdentifierInfo(), MI);
+
+ // If the callbacks want to know, tell them about the macro definition.
+ if (Callbacks)
+ Callbacks->MacroDefined(MacroNameTok.getIdentifierInfo(), MI);
}
/// HandleUndefDirective - Implements #undef.
More information about the cfe-commits
mailing list