[clang] ba84578 - [clang][sema] Add missing diagnostic parameter

Timm Bäder via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 24 01:03:38 PST 2022


Author: Timm Bäder
Date: 2022-01-24T09:59:20+01:00
New Revision: ba845787b3fdd03380b8651d6ce11afeac9d6bba

URL: https://github.com/llvm/llvm-project/commit/ba845787b3fdd03380b8651d6ce11afeac9d6bba
DIFF: https://github.com/llvm/llvm-project/commit/ba845787b3fdd03380b8651d6ce11afeac9d6bba.diff

LOG: [clang][sema] Add missing diagnostic parameter

The test case otherwise fails an assertion in Diagnostic::getArgKind().

Differential Revision: https://reviews.llvm.org/D116595

Added: 
    clang/test/Modules/cxx20-export-import.cpp

Modified: 
    clang/lib/Sema/SemaModule.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaModule.cpp b/clang/lib/Sema/SemaModule.cpp
index 996063f83e946..747734f2d0ff0 100644
--- a/clang/lib/Sema/SemaModule.cpp
+++ b/clang/lib/Sema/SemaModule.cpp
@@ -395,7 +395,7 @@ DeclResult Sema::ActOnModuleImport(SourceLocation StartLoc,
     // [module.interface]p1:
     // An export-declaration shall inhabit a namespace scope and appear in the
     // purview of a module interface unit.
-    Diag(ExportLoc, diag::err_export_not_in_module_interface);
+    Diag(ExportLoc, diag::err_export_not_in_module_interface) << 0;
   }
 
   return Import;

diff  --git a/clang/test/Modules/cxx20-export-import.cpp b/clang/test/Modules/cxx20-export-import.cpp
new file mode 100644
index 0000000000000..a2620bd600649
--- /dev/null
+++ b/clang/test/Modules/cxx20-export-import.cpp
@@ -0,0 +1,3 @@
+
+// RUN: %clang_cc1 -std=c++20 -fmodules -fmodules-cache-path=%t -fimplicit-module-maps -I%S/Inputs -verify %s
+export import dummy; // expected-error {{export declaration can only be used within a module interface unit after the module declaration}}


        


More information about the cfe-commits mailing list