[libcxx-commits] [libcxx] e6a5fb6 - [libc++][NFC] Use if-else chain instead of match, which is a Python 3.10 construct

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Wed Nov 23 05:49:22 PST 2022


Author: Louis Dionne
Date: 2022-11-23T08:49:14-05:00
New Revision: e6a5fb6c238793322a60a90803ac13d84a0103e8

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

LOG: [libc++][NFC] Use if-else chain instead of match, which is a Python 3.10 construct

Added: 
    

Modified: 
    libcxx/utils/generate_iwyu_mapping.py

Removed: 
    


################################################################################
diff  --git a/libcxx/utils/generate_iwyu_mapping.py b/libcxx/utils/generate_iwyu_mapping.py
index 5887f8abcffb5..615c6e3e534a4 100644
--- a/libcxx/utils/generate_iwyu_mapping.py
+++ b/libcxx/utils/generate_iwyu_mapping.py
@@ -35,29 +35,28 @@ def generate_map(include):
 
     for i in detail_files:
         public = []
-        match i:
-            case '__assert': continue
-            case '__availability': continue
-            case '__bit_reference': continue
-            case '__bits': public = ['bits']
-            case '__bsd_locale_defaults.h': continue
-            case '__bsd_locale_fallbacks.h': continue
-            case '__config_site.in': continue
-            case '__config': continue
-            case '__debug': continue
-            case '__errc': continue
-            case '__hash_table': public = ['unordered_map', 'unordered_set']
-            case '__locale': public = ['locale']
-            case '__mbstate_t.h': continue
-            case '__mutex_base': continue
-            case '__node_handle': public = ['map', 'set', 'unordered_map', 'unordered_set']
-            case '__split_buffer': public = ['deque', 'vector']
-            case '__std_stream': public = ['iostream']
-            case '__threading_support': public = ['atomic', 'mutex', 'semaphore', 'thread']
-            case '__tree': public = ['map', 'set']
-            case '__undef_macros': continue
-            case '__verbose_abort': continue
-            case _: panic()
+        if   i == '__assert': continue
+        elif i == '__availability': continue
+        elif i == '__bit_reference': continue
+        elif i == '__bits': public = ['bits']
+        elif i == '__bsd_locale_defaults.h': continue
+        elif i == '__bsd_locale_fallbacks.h': continue
+        elif i == '__config_site.in': continue
+        elif i == '__config': continue
+        elif i == '__debug': continue
+        elif i == '__errc': continue
+        elif i == '__hash_table': public = ['unordered_map', 'unordered_set']
+        elif i == '__locale': public = ['locale']
+        elif i == '__mbstate_t.h': continue
+        elif i == '__mutex_base': continue
+        elif i == '__node_handle': public = ['map', 'set', 'unordered_map', 'unordered_set']
+        elif i == '__split_buffer': public = ['deque', 'vector']
+        elif i == '__std_stream': public = ['iostream']
+        elif i == '__threading_support': public = ['atomic', 'mutex', 'semaphore', 'thread']
+        elif i == '__tree': public = ['map', 'set']
+        elif i == '__undef_macros': continue
+        elif i == '__verbose_abort': continue
+        else: panic()
 
         for p in public:
             result.append(f'{generate(f"<{i}>", p)},')


        


More information about the libcxx-commits mailing list