[all-commits] [llvm/llvm-project] 235056: [clang][Preprocessor] Fix expansion locations for ...
Macro Terra via All-commits
all-commits at lists.llvm.org
Fri Jul 10 05:29:18 PDT 2026
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 235056b9efea87a1a7fa0d36f94e56a44dbd920b
https://github.com/llvm/llvm-project/commit/235056b9efea87a1a7fa0d36f94e56a44dbd920b
Author: Macro Terra <13541229370 at qq.com>
Date: 2026-07-10 (Fri, 10 Jul 2026)
Changed paths:
M clang/docs/ReleaseNotes.md
M clang/lib/Lex/PPMacroExpansion.cpp
M clang/unittests/Tooling/Syntax/TokensTest.cpp
Log Message:
-----------
[clang][Preprocessor] Fix expansion locations for feature-like builtin macros (#207130)
Fixes #196067.
This patch fixes the expansion locations of synthesized tokens produced
by
feature-like builtin macros such as `__has_builtin(...)`.
Feature-like builtin macros lex past the macro name while evaluating
their
arguments. `ExpandBuiltinMacro()` used the final `Tok` location as both
the
expansion start and end when creating the synthesized result token, so
`__has_builtin(...)` results were anchored at the closing paren rather
than the
builtin macro invocation.
Fix by saving the macro-name location before argument parsing and using
it as
the expansion start. The expansion end remains the final `Tok` location.
Add a `syntax::TokenCollector` regression test for a valid
`__has_builtin(...)`
expansion and the `__is_identifier;` recovery path.
Tested:
`ninja -C /home/ubuntu2404/build-196067-assert check-clang`
Total Discovered Tests: 52396
Skipped: 6
Unsupported: 5782
Passed: 46582
Expectedly Failed: 26
Assisted-by: OpenAI Codex
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list