[clang] [clang-scan-deps] Ignore import/include directives with missing filenames (PR #99520)
Michael Spencer via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 18 16:03:17 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))
----------------
Bigcheese wrote:
Does this end up with the entire rest of the file being part of the directive? I think another issue here is that the lexer does not consider the newline at the end of the import as `eod`.
I think the change is still fine though, it's better to not infinite loop even if the lexer is wrong.
https://github.com/llvm/llvm-project/pull/99520
More information about the cfe-commits
mailing list