[clang] [clang][Sema] Add diagnostic note for reference of function-like macros requiring without parentheses (PR #123495)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Sep 7 03:55:30 PDT 2026
StarOne01 wrote:
Apologies for letting this go quiet for so long, @AaronBallman. Picked this back up and rebased onto current `main`.
The current implementation doesn't depend on `*Out`'s state anymore, the macro check was pulled into a standalone `isFunctionLikeMacro()` helper, called unconditionally after `R.clear()` at the end of `DiagnoseEmptyLookup` regardless of whether typo correction fired. `test5` in `typo-correction.c` covers the `F + 1;` vs `g(F)` discrepancy directly, and both now produce the same diagnostic.
Ran the full Sema test suite after rebasing. One incidental find: `c23-varargs.c` needed updated expectations, since `va_start` (a builtin function-like macro) now correctly triggers this diagnostic instead of the old undeclared-identifier error when used without parens pre-C23. Updated that test to match. Everything else passes clean (1155/1155 supported tests).
Happy to make further changes if there's still concern about the approach.
https://github.com/llvm/llvm-project/pull/123495
More information about the cfe-commits
mailing list