Skip to content

Commit cea81e9

Browse files
[clang-format] add support for cppm files
C++20 Modules current style is to assign a new file suffix .cppm. #52658 Ensure git-clang-format can handle that as a default extension Reviewed By: ChuanqiXu, HazardyKnusperkeks, curdeius Differential Revision: https://reviews.llvm.org/D115625 Fixes: #52658
1 parent 6482383 commit cea81e9

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

clang/tools/clang-format/clang-format-diff.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ def main():
4747
help='custom pattern selecting file paths to reformat '
4848
'(case sensitive, overrides -iregex)')
4949
parser.add_argument('-iregex', metavar='PATTERN', default=
50-
r'.*\.(cpp|cc|c\+\+|cxx|c|cl|h|hh|hpp|hxx|m|mm|inc|js|ts'
51-
r'|proto|protodevel|java|cs|json)',
50+
r'.*\.(cpp|cc|c\+\+|cxx|cppm|ccm|cxxm|c\+\+m|c|cl|h|hh|hpp|hxx'
51+
r'|m|mm|inc|js|ts|proto|protodevel|java|cs|json)',
5252
help='custom pattern selecting file paths to reformat '
5353
'(case insensitive, overridden by -regex)')
5454
parser.add_argument('-sort-includes', action='store_true', default=False,

clang/tools/clang-format/git-clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ def main():
7979
'm', # ObjC
8080
'mm', # ObjC++
8181
'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', # C++
82+
'ccm', 'cppm', 'cxxm', 'c++m', # C++ Modules
8283
'cu', 'cuh', # CUDA
8384
# Other languages that clang-format supports
8485
'proto', 'protodevel', # Protocol Buffers

0 commit comments

Comments
 (0)