[clang] [Clang][Lex] Fix __has_include_next to return false when no valid next dir (PR #173721)
Zachary Fogg via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 7 04:31:30 PST 2026
zfogg wrote:
bump
I retested the absolute-path case with Homebrew LLVM/Clang 23.1.5 on Intel macOS. When a header is force-included by absolute path and contains `#if __has_include_next(<present.h>)`, Clang warns that it will search from the start of the include path and the condition evaluates true if `present.h` exists there. This is the behavior the proposed change addresses.
For context, we replaced our C++ LibTooling-based source transformer with a Python tool that calls libclang's C API using the project's compilation database. That tool successfully parses and builds our affected project files with LLVM 23 on macOS, Linux, and Windows. This is a different API and configuration, not a fix to `__has_include_next` or evidence that the original LLVM 21 phantom-file failure has been reproduced unchanged on LLVM 23.
Would appreciate another look at the absolute-path behavior and this PR.
https://github.com/llvm/llvm-project/pull/173721
More information about the cfe-commits
mailing list