[clang] [clang][dep-scan] Resolve lexer crash from a permutation of invalid tokens (PR #142452)

Cyndy Ishida via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 5 18:01:24 PDT 2025


================
@@ -503,6 +503,10 @@ bool Scanner::lexModuleDirectiveBody(DirectiveKind Kind, const char *&First,
           diag::err_dep_source_scanner_missing_semi_after_at_import);
     if (Tok.is(tok::semi))
       break;
+    if (Tok.is(tok::hash) || Tok.is(tok::at))
+      return reportError(
----------------
cyndyishida wrote:

Thank you for taking a look! Applied your suggested patch, with minor tweaks. 

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


More information about the cfe-commits mailing list