[Clang][Preprocessor] Unify header-name lookahead for import and include (#191004)
Introduce Preprocessor::isNextPPTokenHeaderNameOrOneOf to centralize
lookahead logic for header-name formation and token classification under
ParsingFilename mode.
Refactor handling of C++20 module/import contextual keywords and
LexHeaderName to use the new helper, ensuring consistent behavior
between `import` and `#include`.
Try to form a valid header-name token during lookahead. If that fails
and the next token is not one of the expected alternatives, treat it as
not an `import` directive or as an invalid `#include` (missing
<FILENAME>/"FILENAME").
```cpp
#define FOO foo>
#include <:FOO
```
Now such cases are rejected as expected.
Also adjusts peekNextPPToken to properly support dependency directive
lexers.
No functional change intended for valid code; improves correctness and
consistency in edge cases involving header-name lexing.
Fixes https://github.com/llvm/llvm-project/issues/190693.
---------
Signed-off-by: yronglin <yronglin777@gmail.com>
Signed-off-by: Yihan Wang <yronglin777@gmail.com>