Turn on PPCallBacks

Hi all,

Can someone tell how to turn on PPCallBacks? I get no Callback functions calls.

I have very simple code:

class MacroDefinitionCallback : public PPCallbacks {
public:
MacroDefinitionCallback() {}
void MacroDefined(const Token &MacroNameTok, const MacroDirective *MD) {
cerr << “MacroDefined” << endl;
}
}

int main() {

MacroDefinitionCallback MDC;
ci.getPreprocessor().addPPCallbacks(llvm::make_unique(MDC));

do {
ci.getPreprocessor().Lex(tok); // or LexUnexpandedToken
// ci.getPreprocessor().DumpToken(tok); // All tokens are printed, it is OK
} while ( tok.isNot(clang::tok::eof));

}

Preprocessed file source:
#define sum(a, b) (a) + (b)

int main() {
int s = sum(1, 2);
}

This program doesn’t print anything, so what is the way to turn on the callback?

Timur