forked from OSchip/llvm-project
add a ppcallback hook for macro definitions.
llvm-svn: 68883
This commit is contained in:
parent
c523d8e88c
commit
928e9096cb
|
@ -55,10 +55,15 @@ public:
|
|||
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
|
||||
|
|
|
@ -1402,6 +1402,10 @@ void Preprocessor::HandleDefineDirective(Token &DefineTok) {
|
|||
}
|
||||
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue