[libcxx-commits] [PATCH] D117438: [libc++] [test] Check for another kind of modulemap typo in lint_modulemap.sh.py.

Arthur O'Dwyer via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Sun Jan 16 11:55:53 PST 2022


Quuxplusone created this revision.
Quuxplusone added a reviewer: libc++.
Quuxplusone added a project: libc++.
Quuxplusone requested review of this revision.
Herald added a subscriber: libcxx-commits.
Herald added 1 blocking reviewer(s): libc++.

Verify that the name of the private submodule matches the name of the detail header.
If CI is green, I'll land this.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D117438

Files:
  libcxx/include/module.modulemap
  libcxx/test/libcxx/lint/lint_modulemap.sh.py


Index: libcxx/test/libcxx/lint/lint_modulemap.sh.py
===================================================================
--- libcxx/test/libcxx/lint/lint_modulemap.sh.py
+++ libcxx/test/libcxx/lint/lint_modulemap.sh.py
@@ -18,6 +18,19 @@
     with open(modulemap_name, 'r') as f:
         for line in f.readlines():
             if re.match(r'^\s*module.*[{]\s*private', line):
+                # Check that these lines are all of the expected format.
+                # This incidentally checks for typos in the module name.
+                if re.match(r'^\s*module (\w+)\s+[{] private header "\1(.h)?"\s+export [*] [}]', line):
+                    # It's a top-level private header, such as <__bit_reference>.
+                    pass
+                elif re.match(r'^\s*module (\w+)\s+[{] private header "__\w+/\1[.]h" [}]', line):
+                    # It's a private submodule, such as <__utility/swap.h>.
+                    pass
+                else:
+                    okay = False
+                    print("LINE DOESN'T MATCH REGEX in libcxx/include/module.modulemap!")
+                    print(line)
+                # Check that these lines are alphabetized.
                 if (prevline is not None) and (line < prevline):
                     okay = False
                     print('LINES OUT OF ORDER in libcxx/include/module.modulemap!')
Index: libcxx/include/module.modulemap
===================================================================
--- libcxx/include/module.modulemap
+++ libcxx/include/module.modulemap
@@ -989,7 +989,7 @@
   module __function_like     { private header "__function_like.h"   export * }
   module __hash_table        {         header "__hash_table"        export * }
   module __locale            { private header "__locale"            export * }
-  module __mbstate           { private header "__mbstate_t.h"       export * }
+  module __mbstate_t         { private header "__mbstate_t.h"       export * }
   module __mutex_base        { private header "__mutex_base"        export * }
   module __node_handle       { private header "__node_handle"       export * }
   module __nullptr           {         header "__nullptr"           export * }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117438.400398.patch
Type: text/x-patch
Size: 2206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220116/3c6750e3/attachment.bin>


More information about the libcxx-commits mailing list