From 574ee1c02ef73b66c5957cf93888234b0471695f Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Thu, 17 Aug 2023 11:42:32 +0800 Subject: [C++20] [Modules] Prevent to accept clang modules Close https://github.com/llvm/llvm-project/issues/64755 This wouldn't affect the form @import as the test shows. The two affected test case `diag-flags.cpp` and `diag-pragma.cpp` are old test cases in 2017 and 2018, when we're not so clear about the direction of modules. And the things that these 2 tests tested can be covered by clang modules naturally. So I change the them into clang modules to not block this patch. --- clang/lib/Sema/SemaModule.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'clang/lib/Sema/SemaModule.cpp') diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp index cd38cd4..9b8af60 100644 --- a/clang/lib/Sema/SemaModule.cpp +++ b/clang/lib/Sema/SemaModule.cpp @@ -531,6 +531,12 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc, if (!Mod) return true; + if (!Mod->isInterfaceOrPartition() && !ModuleName.empty()) { + Diag(ImportLoc, diag::err_module_import_non_interface_nor_parition) + << ModuleName; + return true; + } + return ActOnModuleImport(StartLoc, ExportLoc, ImportLoc, Mod, Path); } -- cgit v1.1