Skip to content

Commit

Permalink
[clang-format] add support for cppm files
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mydeveloperday committed Dec 14, 2021
1 parent 6482383 commit cea81e9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions clang/tools/clang-format/clang-format-diff.py
Expand Up @@ -47,8 +47,8 @@ def main():
help='custom pattern selecting file paths to reformat '
'(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'.*\.(cpp|cc|c\+\+|cxx|cppm|ccm|cxxm|c\+\+m|c|cl|h|hh|hpp|hxx'
r'|m|mm|inc|js|ts|proto|protodevel|java|cs|json)',
help='custom pattern selecting file paths to reformat '
'(case insensitive, overridden by -regex)')
parser.add_argument('-sort-includes', action='store_true', default=False,
Expand Down
1 change: 1 addition & 0 deletions clang/tools/clang-format/git-clang-format
Expand Up @@ -79,6 +79,7 @@ def main():
'm', # ObjC
'mm', # ObjC++
'cc', 'cp', 'cpp', 'c++', 'cxx', 'hh', 'hpp', 'hxx', # C++
'ccm', 'cppm', 'cxxm', 'c++m', # C++ Modules
'cu', 'cuh', # CUDA
# Other languages that clang-format supports
'proto', 'protodevel', # Protocol Buffers
Expand Down

0 comments on commit cea81e9

Please sign in to comment.