HazardyKnusperkeks wrote: > > If you want to work on this, the fixer should check if this is currently an > > include statement or a macro invocation. Shouldn't be that hard and can > > definitely be two distinct PRs. > > It seems like macro invocation is difficult due to the fact that they can be > defined in some other header file, e.g. > > ``` > // a.h > #define FOO(x) foo##x > ``` > > ``` > // b.c > #include "a.h" > FOO(16header) > ``` > > Given that it currently formats the raw lexer output, how would it be able to > deduce that FOO is a macro invocation when formatting b.c without recursively > preprocessing includes? @HazardyKnusperkeks
We never parse `#define`s to store the definition or the name. Even because they can come from different files. But we have `FormatToken::isPossibleMacro`. And for everything else there is the `Macros` options (and many smaller flavors). But the `isPossibleMacro` function should apply to most real world scenarios. https://github.com/llvm/llvm-project/pull/206516 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
