[clang] [clang-scan-deps] Ignore import/include directives with missing filenames (PR #99520)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 19 07:12:35 PDT 2024


================
@@ -544,7 +544,7 @@ Scanner::lexIncludeFilename(const char *&First, const char *const End) {
 void Scanner::lexPPDirectiveBody(const char *&First, const char *const End) {
   while (true) {
     const dependency_directives_scan::Token &Tok = lexToken(First, End);
-    if (Tok.is(tok::eod))
+    if (Tok.is(tok::eod) || Tok.is(tok::eof))
----------------
cyndyishida wrote:

If I understand you correctly, that's actually what happened before I added the `skipDirective` on [line 905](https://github.com/llvm/llvm-project/pull/99520/files#diff-ee296172b8a9dd81c5185e78a512c2fc89f7abfe5b2d035e96537fce7dbbbc9cR905) 

Previously, input that was macro or header-guarded would fail with 
```
error: unterminated conditional directive
```
because the directive line for the `include` absorbed up the `#endif`.

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


More information about the cfe-commits mailing list