The parsing logic has been separated out from the macro implementation logic, leading to a number of improvements:
- Gracefully handle unexpected/invalid tokens, too few, too many and nested parameters
- Provide consistent behaviour between all built-in feature-like macros
- Simplify the implementation of macro logic
- Fix __is_identifier to correctly return '0' for non-identifiers
Use llvm::function_ref here instead, and don't pass a Preprocessor into the function (instead, capture it in a lambda).