[PATCH] D118893: [C++20][Modules] Track valid import state.

Nathan Sidwell via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 15 10:46:06 PST 2022


urnathan added a comment.

Looks right to me -- I also implemented such a state machine in GCC's parser.  There are a bunch of formatting issues to fix of course.



================
Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1543
+def err_import_not_allowed_here : Error<
+  "imports must be contiguous and immediately follow the module declaration">;
+def err_import_in_global_fragment : Error<
----------------
"imports must immediately follow a module declaration"?  (the contiguous isn't adding anything IMHO)


================
Comment at: clang/include/clang/Basic/DiagnosticParseKinds.td:1544-1547
+def err_import_in_global_fragment : Error<
+  "module%select{| partition}0 imports cannot be in the global module fragment">;
+def err_import_in_private_fragment : Error<
+  "module%select{| partition}0 imports cannot be in the private module fragment">;
----------------
You could I suppose have a single diagnostuc and select between global & private?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D118893/new/

https://reviews.llvm.org/D118893



More information about the cfe-commits mailing list