How do I redefine a macro?

I have the IdentifierInfo for the macro to redefine, I have the tokens for the new definition of the macro.

How do I actually set the new tokens as the definition for the macro?

I’ve tried using MacroInfo::setTokens, and it’s not working.

I’ve also tried to use appendDefMacroDirective and it is also not working.

In a source file, you need to #undef a macro before redefining it. Naively I’d suggest seeing what clang does with an #undef followed by a new #define.
(I really know very little about how the frontend works…)

No no no.

I’m making a new pragma called redefine_macro, it contains the name of the macro to redefine and the new definition.

How do I actually append the new definition to the macro history in Clang?

See Preprocessor::HandleDefineDirective?