[PATCH] D115625: [clang-format] add support for cppm files

MyDeveloperDay via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Dec 13 03:55:12 PST 2021


MyDeveloperDay created this revision.
MyDeveloperDay added reviewers: ChuanqiXu, HazardyKnusperkeks, curdeius, krasimir.
MyDeveloperDay added projects: clang, clang-format.
MyDeveloperDay requested review of this revision.

C++20 Modules current style is to assign a new file suffix .cppm instead of .cpp and .h

Ensure git-clang-format can handle that as a default extension


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D115625

Files:
  clang/tools/clang-format/clang-format-diff.py
  clang/tools/clang-format/git-clang-format


Index: clang/tools/clang-format/git-clang-format
===================================================================
--- clang/tools/clang-format/git-clang-format
+++ clang/tools/clang-format/git-clang-format
@@ -78,7 +78,7 @@
       'c', 'h',  # C
       'm',  # ObjC
       'mm',  # ObjC++
-      'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx',  # C++
+      'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', 'cppm'  # C++
       'cu', 'cuh',  # CUDA
       # Other languages that clang-format supports
       'proto', 'protodevel',  # Protocol Buffers
Index: clang/tools/clang-format/clang-format-diff.py
===================================================================
--- clang/tools/clang-format/clang-format-diff.py
+++ clang/tools/clang-format/clang-format-diff.py
@@ -48,7 +48,7 @@
                       '(case sensitive, overrides -iregex)')
   parser.add_argument('-iregex', metavar='PATTERN', default=
                       r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
-                      r'|proto|protodevel|java|cs|json)',
+                      r'|proto|protodevel|java|cs|json|cppm)',
                       help='custom pattern selecting file paths to reformat '
                       '(case insensitive, overridden by -regex)')
   parser.add_argument('-sort-includes', action='store_true', default=False,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D115625.393845.patch
Type: text/x-patch
Size: 1353 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20211213/3f7b6eb6/attachment.bin>


More information about the cfe-commits mailing list