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

Qiu Chaofan via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 3 00:11:06 PST 2025


https://github.com/ecnelises commented:

The change works directly in the header search facilities under PP level, so I think it can handle various cases properly. It would be nice to add more test cases including:

- `#include <...>`
- `#include_next`
- `#import`
- `-isystem`
- `-cxx-isystem`
- `-iframework`
- `-include`
- system headers (say C++ stdlib has a private some.h, and we have custom some.h)

to ensure the behavior (unluckily path related options are really complex 🙃).

I also worry if warnings explode when the CU includes a number of files:

```
// a.cpp
#include "a.h"
#include "b.h"
#include "c.h"

// a.h
#pragma once
#include "b.h"

// b.h
#pragma once
#include "c.h"

// c.h
#pragma once
```

The warning repeats three times if `c.h` has something shadowed.

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


More information about the cfe-commits mailing list