aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaModule.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2023-08-17 11:42:32 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2023-08-17 11:45:50 +0800
commit574ee1c02ef73b66c5957cf93888234b0471695f (patch)
tree5d4c9540b9f83f87686621355e6fe5ae59d1d9c0 /clang/lib/Sema/SemaModule.cpp
parentd3402bc4460acefbc3d5278743601fa090784614 (diff)
downloadllvm-574ee1c02ef73b66c5957cf93888234b0471695f.zip
llvm-574ee1c02ef73b66c5957cf93888234b0471695f.tar.gz
llvm-574ee1c02ef73b66c5957cf93888234b0471695f.tar.bz2
[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.
Diffstat (limited to 'clang/lib/Sema/SemaModule.cpp')
-rw-r--r--clang/lib/Sema/SemaModule.cpp6
1 files changed, 6 insertions, 0 deletions
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);
}