[clang] [Clang] Reject and recover from malformed module directive (PR #245099)

Aleksei Poleskov via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 23 23:46:04 PST 2026


================
@@ -4362,11 +4362,24 @@ void Preprocessor::HandleCXXModuleDirective(Token ModuleTok) {
     DirToks.push_back(Tok);
     LexUnexpandedToken(Tok);
     if (Tok.isNot(tok::kw_private)) {
-      if (Tok.isNot(tok::eod))
-        CheckEndOfDirective(ModuleTok.getIdentifierInfo()->getName(),
-                            /*EnableMacros=*/false, &DirToks);
-      EnterModuleSuffixTokenStream(DirToks);
-      return;
+      // Remember wrong token location.
----------------
the-lenoz wrote:

Probably not, I'll remove them. Added it to justify my and my companion's solution

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


More information about the cfe-commits mailing list