[clang] [Clang][Preprocessor] Unify header-name lookahead for import and include (PR #191004)

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Apr 15 11:34:16 PDT 2026


zygoloid wrote:

This seems like a corner case of a corner case.

Are there file systems in active use with Clang for which `#include <%...>` or `#include <:...>` or `#include <<...>` would be reasonable inclusions? @hubert-reinterpretcast Does z/OS have something like that? I think that'd be the most likely place.

Even if such file paths exist, how commonly do we perform the "reconstitute a header-name token from a sequence of preprocessing-tokens" operation? I think this mostly comes up in cases like:
```c++
#if CONFIG_MACRO
#define INCLUDE <foo>
#else
#define INCLUDE <bar>
#endif

#include INCLUDE
```
but in my experience such things are rare and people more often do
```c++
#if CONFIG_MACRO
#include <foo>
#else
#include <bar>
#endif
```
... in order to not confuse simple include / dependency scanner systems.

If the paths aren't common on any system that Clang targets, I don't think it's work carrying an extension for this.

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


More information about the cfe-commits mailing list