[clang] [clang] Support header shadowing diagnostics in Clang header search (PR #162491)

Tom Honermann via cfe-commits cfe-commits at lists.llvm.org
Tue Oct 21 15:50:10 PDT 2025


https://github.com/tahonermann commented:

Clang currently fails to resolve header files the same way that MSVC does when operating in its cl-compatible driver mode. I have a PR that corrects this (https://github.com/llvm/llvm-project/pull/105738), but I still need to add some docs before taking that PR out of draft status. The code in that PR will ship with the next Intel oneAPI compiler release; I hope to land it soon-ish.

I am worried that this diagnostic will be quite noisy for some projects. I think a more useful improvement would be more diagnostics for cases where `clang` and `clang-cl` would resolve a header file differently. I see you already found the one existing case of such a diagnostic [here](https://github.com/llvm/llvm-project/blob/e29d4ebb89705162b588caf69b45581f1da3a45c/clang/lib/Lex/HeaderSearch.cpp#L1000-L1012).

Is there special handling for `#include_next`? If not, wouldn't effectively every use of `#include_next` be accompanied by this new warning? Or am I misunderstanding something?

https://github.com/llvm/llvm-project/pull/162491


More information about the cfe-commits mailing list