aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/Sema/SemaModule.cpp
diff options
context:
space:
mode:
authorChuanqi Xu <yedeng.yd@linux.alibaba.com>2023-05-18 16:11:20 +0800
committerChuanqi Xu <yedeng.yd@linux.alibaba.com>2023-05-18 16:12:41 +0800
commitfc89e9044d0b37dcd4e3f085f21bef1b21d2ab8d (patch)
tree816d83c3fca240ee2cfc008f2400a8a53e65f073 /clang/lib/Sema/SemaModule.cpp
parent3cabfe666cdbb24900873277e583108176c82b6c (diff)
downloadllvm-fc89e9044d0b37dcd4e3f085f21bef1b21d2ab8d.zip
llvm-fc89e9044d0b37dcd4e3f085f21bef1b21d2ab8d.tar.gz
llvm-fc89e9044d0b37dcd4e3f085f21bef1b21d2ab8d.tar.bz2
[C++20] [Modules] Emit an warning for experimental header units
Currently, the header units are rarely used and it is not well tested. To avoid further misunderstandings, let's mark it as experimental and emit a warning when users wants to import it. This is discussed in modules developers meeting.
Diffstat (limited to 'clang/lib/Sema/SemaModule.cpp')
-rw-r--r--clang/lib/Sema/SemaModule.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp
index e1d7c29..a1ab013 100644
--- a/clang/lib/Sema/SemaModule.cpp
+++ b/clang/lib/Sema/SemaModule.cpp
@@ -544,6 +544,9 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc,
SourceLocation ExportLoc,
SourceLocation ImportLoc, Module *Mod,
ModuleIdPath Path) {
+ if (Mod->isHeaderUnit())
+ Diag(ImportLoc, diag::warn_experimental_header_unit);
+
VisibleModules.setVisible(Mod, ImportLoc);
checkModuleImportContext(*this, Mod, ImportLoc, CurContext);