This is the first part of the implementation of the inclusion of macro expansions into the plist output.
This approach is very much different to what HTMLRewrite does -- the motivation behind this was that
- I really wanted to avoid const_cast,
- This patch aims to only expand macros relevant to the bugpath, so there's no point in lexing everything.
Sadly, it seems like I couldn't get away with a solution not re-implementing parts of the preprocessor -- macro arguments are expanded manually and somewhat painfully, but I am very confident about it's stability and correctness.
How I'm planning to do this:
- A new analyzer option was added to turn macro expansions on.
- BugReporter will compact the bugpath when that flag is enabled, thus creating PathDiagnosticMacroPieces. (fun fact: they were never created for plists before!)
- (Implemented in a separate patch) When a macro is emitted,
- a lexer is created to acquire the macro's name and arguments.
- The actual definition of the macro can be acquired from the Preprocessor.
- Should one of the tokens of the definition the parameter of the current macro, it has to be replaced manually with the information we gathered by lexing.
- Should one of them be be a macro, it will be expanded recursively. The information about parameters is passed on.