[PATCH] D116595: [clang][sema] Add missing diagnostic parameter

Timm Bäder via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 4 04:51:53 PST 2022


tbaeder created this revision.
tbaeder added a reviewer: rsmith.
tbaeder requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

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

  clang++: /home/tbaeder/code/llvm-project/clang/include/clang/Basic/Diagnostic.h:1571: clang::DiagnosticsEngine::ArgumentKind clang::Diagnostic::getArgKind(unsigned int) const: Assertion `Idx < getNumArgs() && "Argument index out of range!"' failed.
  PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace, preprocessed source, and associated run script.
  Stack dump:
  0.	Program arguments: bin/clang++ module_import.cpp -std=c++20 -fmodules -fimplicit-module-maps -I. -stdlib=libc++ -fsyntax-only
  1.	module_import.cpp:1:20: current parser token ';'
  
  ...


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D116595

Files:
  clang/lib/Sema/SemaModule.cpp
  clang/test/Modules/cxx20-export-import.cpp


Index: clang/test/Modules/cxx20-export-import.cpp
===================================================================
--- /dev/null
+++ 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 -stdlib=libc++ -verify %s
+export import dummy; // expected-error {{export declaration can only be used within a module interface unit after the module declaration}}
Index: clang/lib/Sema/SemaModule.cpp
===================================================================
--- clang/lib/Sema/SemaModule.cpp
+++ clang/lib/Sema/SemaModule.cpp
@@ -395,7 +395,7 @@
     // [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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D116595.397267.patch
Type: text/x-patch
Size: 968 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220104/9c4f6b5f/attachment.bin>


More information about the cfe-commits mailing list