[clang] [C++20] [Modules] Warn for importing implementation partition unit in interface units (PR #108493)

Chuanqi Xu via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 13 19:35:36 PDT 2024


================
@@ -650,6 +650,14 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc,
   else
     VisibleModules.setVisible(Mod, ImportLoc);
 
+  assert((!Mod->isModulePartitionImplementation() || getCurrentModule()) &&
+         "We can only import a partition unit in a named module.");
+  if (Mod->isModulePartitionImplementation() &&
+      getCurrentModule()->isModuleInterfaceUnit())
+    Diag(ImportLoc,
+         diag::warn_import_implementation_partition_unit_in_interface_unit)
+        << Mod->Name;
----------------
ChuanqiXu9 wrote:

Got it. I'll try to make it next time

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


More information about the cfe-commits mailing list