[clang] [clang-format] fix: add missing `default_extensions` values to `git-clang-format` (PR #117730)

via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 26 07:51:41 PST 2024


https://github.com/lumirlumir created https://github.com/llvm/llvm-project/pull/117730

Hello,

Although the properties listed in the code below are used as supported file extensions, some of these extensions do not exist in `git-clang-format`. This causes inconsistency when using `git-clang-format` with `clang-format`.

Therefore, I added the missing supported default extensions to `git-clang-format`.

https://github.com/llvm/llvm-project/blob/b214ca82daeece1568268ebc0fbcc2eaa649425b/clang/tools/clang-format/ClangFormat.cpp#L87-L96

>From 6536003db6ce2bef1c736dc34c2637c53e19e998 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=EB=A3=A8=EB=B0=80LuMir?= <rpfos at naver.com>
Date: Wed, 27 Nov 2024 00:45:52 +0900
Subject: [PATCH] [clang-format] fix: add missing `default_extensions` values
 to `git-clang-format`

---
 clang/tools/clang-format/git-clang-format | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/clang/tools/clang-format/git-clang-format b/clang/tools/clang-format/git-clang-format
index bacbd8de245666..6a2a2a22ec5c2b 100755
--- a/clang/tools/clang-format/git-clang-format
+++ b/clang/tools/clang-format/git-clang-format
@@ -94,11 +94,13 @@ def main():
       # Other languages that clang-format supports
       'proto', 'protodevel',  # Protocol Buffers
       'java',  # Java
-      'js',  # JavaScript
+      'mjs', 'js',  # JavaScript
       'ts',  # TypeScript
       'cs',  # C Sharp
       'json',  # Json
-      'sv', 'svh', 'v', 'vh', # Verilog
+      'sv', 'svh', 'v', 'vh',  # Verilog
+      'td',  # TableGen
+      'txtpb', 'textpb', 'pb.txt', 'textproto', 'asciipb',  # TextProto
       ])
 
   p = argparse.ArgumentParser(



More information about the cfe-commits mailing list