[libcxx-commits] [libcxx] 2c629eb - [libc++][CI] Fixes error messages.

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Thu Aug 17 09:08:54 PDT 2023


Author: Mark de Wever
Date: 2023-08-17T18:08:47+02:00
New Revision: 2c629eb5087a48db21cabd4bf3098f5c58b16573

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

LOG: [libc++][CI] Fixes error messages.

Fixes 2 error messages from the module test clang-tidy plugin.
- an issue where an empty filename can't be used in an AST matcher
- an issue where no filename is valid when testing the std module cppm
This reduces the output of the test, making it easier to find the real
error when the test fails.

Reviewed By: philnik, #libc

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

Added: 
    

Modified: 
    libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp

Removed: 
    


################################################################################
diff  --git a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
index 281d1ec6dfdb0e..fba48d5984ea77 100644
--- a/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
+++ b/libcxx/test/tools/clang_tidy_checks/header_exportable_declarations.cpp
@@ -38,15 +38,18 @@ header_exportable_declarations::header_exportable_declarations(
       filename_(Options.get("Filename", "")),
       file_type_(Options.get("FileType", header_exportable_declarations::FileType::Unknown)),
       extra_header_(Options.get("ExtraHeader", "")) {
-  if (filename_.empty())
-    llvm::errs() << "No filename is provided.\n";
-
   switch (file_type_) {
   case header_exportable_declarations::FileType::Header:
-    /* DO NOTHING */
+    if (filename_.empty())
+      llvm::errs() << "No filename is provided.\n";
+    if (extra_header_.empty())
+      extra_header_ = "$^"; // Use a never matching regex to silence an error message.
     break;
-  case header_exportable_declarations::FileType::Module:
   case header_exportable_declarations::FileType::ModulePartition:
+    if (filename_.empty())
+      llvm::errs() << "No filename is provided.\n";
+    [[fallthrough]];
+  case header_exportable_declarations::FileType::Module:
     if (!extra_header_.empty())
       llvm::errs() << "Extra headers are not allowed for modules.\n";
     if (Options.get("SkipDeclarations"))


        


More information about the libcxx-commits mailing list