From fc89e9044d0b37dcd4e3f085f21bef1b21d2ab8d Mon Sep 17 00:00:00 2001 From: Chuanqi Xu Date: Thu, 18 May 2023 16:11:20 +0800 Subject: [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. --- clang/lib/Sema/SemaModule.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'clang/lib/Sema/SemaModule.cpp') 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); -- cgit v1.1