summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormydeveloperday <mydeveloperday@gmail.com>2021-12-14 14:55:38 +0000
committermydeveloperday <mydeveloperday@gmail.com>2021-12-14 14:55:38 +0000
commitcea81e95b05f92d1dd24547e086ec97b9510634a (patch)
tree4147b0648d6ae2666beca52f0e257113cbbfd571
parent6482383e50a4f02e337e7ce61a471e6295f008e4 (diff)
downloadllvm-cea81e95b05f92d1dd24547e086ec97b9510634a.tar.gz
[clang-format] add support for cppm files
C++20 Modules current style is to assign a new file suffix .cppm. https://github.com/llvm/llvm-project/issues/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
-rwxr-xr-xclang/tools/clang-format/clang-format-diff.py4
-rwxr-xr-xclang/tools/clang-format/git-clang-format1
2 files changed, 3 insertions, 2 deletions
diff --git a/clang/tools/clang-format/clang-format-diff.py b/clang/tools/clang-format/clang-format-diff.py
index 28ac0275615c..1f6ff0fe295f 100755
--- a/clang/tools/clang-format/clang-format-diff.py
+++ b/clang/tools/clang-format/clang-format-diff.py
@@ -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,
diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format
index bb5b5546d6a5..7838fd82c1dd 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -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