[libcxx-commits] [libcxx] [libcxxabi] [libc++abi] Use the same .clang-format as libc++ (PR #208661)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jul 30 05:10:08 PDT 2026


https://github.com/philnik777 updated https://github.com/llvm/llvm-project/pull/208661

>From 5a0f960e7fc2e84eb89c59562833866812510edd Mon Sep 17 00:00:00 2001
From: Nikolas Klauser <nikolasklauser at berlin.de>
Date: Fri, 10 Jul 2026 10:47:39 +0200
Subject: [PATCH] [libc++abi] Use the same .clang-format as libc++

---
 libcxx/.clang-format    |  2 ++
 libcxxabi/.clang-format | 77 ++++++++++++++++++++++++++++++++++++++---
 2 files changed, 75 insertions(+), 4 deletions(-)

diff --git a/libcxx/.clang-format b/libcxx/.clang-format
index 9a455d304eb56..c99c535fe0ce1 100644
--- a/libcxx/.clang-format
+++ b/libcxx/.clang-format
@@ -3,6 +3,8 @@ BasedOnStyle: LLVM
 # detected as Cpp, but others are detected as ObjC and we want this formatting
 # to apply to all types of files.
 
+# libcxx/.clang-format and libcxxabi/.clang-format are identical. Both of them should by modified in sync.
+
 AlignAfterOpenBracket: Align
 AlignConsecutiveAssignments: Consecutive
 AlignConsecutiveBitFields: Consecutive
diff --git a/libcxxabi/.clang-format b/libcxxabi/.clang-format
index b4f56c0de9819..c99c535fe0ce1 100644
--- a/libcxxabi/.clang-format
+++ b/libcxxabi/.clang-format
@@ -1,14 +1,83 @@
 BasedOnStyle: LLVM
+# Note that we don't specify the language in this file because some files are
+# detected as Cpp, but others are detected as ObjC and we want this formatting
+# to apply to all types of files.
 
-Language: Cpp
+# libcxx/.clang-format and libcxxabi/.clang-format are identical. Both of them should by modified in sync.
+
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: Consecutive
+AlignConsecutiveBitFields: Consecutive
+AlignEscapedNewlines: Right
+AlignOperands: AlignAfterOperator
+AlignTrailingComments: true
+AllowAllArgumentsOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortFunctionsOnASingleLine: true
+AllowShortLambdasOnASingleLine: All
+AttributeMacros: [
+                  '_ALIGNAS_TYPE',
+                  '_ALIGNAS',
+                  '_LIBCPP_ACQUIRE_CAPABILITY',
+                  '_LIBCPP_ACQUIRE_SHARED_CAPABILITY',
+                  '_LIBCPP_ALIGNOF',
+                  '_LIBCPP_ALWAYS_INLINE',
+                  '_LIBCPP_CAPABILITY',
+                  '_LIBCPP_CONSTEXPR_SINCE_CXX14',
+                  '_LIBCPP_CONSTEXPR_SINCE_CXX17',
+                  '_LIBCPP_CONSTEXPR_SINCE_CXX20',
+                  '_LIBCPP_CONSTEXPR_SINCE_CXX23',
+                  '_LIBCPP_CONSTEXPR',
+                  '_LIBCPP_DEPRECATED_IN_CXX11',
+                  '_LIBCPP_DEPRECATED_IN_CXX14',
+                  '_LIBCPP_DEPRECATED_IN_CXX17',
+                  '_LIBCPP_DEPRECATED_IN_CXX20',
+                  '_LIBCPP_DEPRECATED_IN_CXX23',
+                  '_LIBCPP_DEPRECATED',
+                  '_LIBCPP_DIAGNOSE_NULLPTR_IF',
+                  '_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION',
+                  '_LIBCPP_EXPORTED_FROM_ABI',
+                  '_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS',
+                  '_LIBCPP_FALLTHROUGH',
+                  '_LIBCPP_HIDDEN',
+                  '_LIBCPP_HIDE_FROM_ABI_AFTER_V1',
+                  '_LIBCPP_HIDE_FROM_ABI',
+                  '_LIBCPP_NO_SANITIZE',
+                  '_LIBCPP_NO_UNIQUE_ADDRESS',
+                  '_LIBCPP_NOALIAS',
+                  '_LIBCPP_OVERRIDABLE_FUNC_VIS',
+                  '_LIBCPP_RELEASE_CAPABILITY',
+                  '_LIBCPP_REQUIRES_CAPABILITY',
+                  '_LIBCPP_SCOPED_LOCKABLE',
+                  '_LIBCPP_STANDALONE_DEBUG',
+                  '_LIBCPP_TEMPLATE_DATA_VIS',
+                  '_LIBCPP_TRY_ACQUIRE_CAPABILITY',
+                  '_LIBCPP_TRY_ACQUIRE_SHARED_CAPABILITY',
+                  '_LIBCPP_USING_IF_EXISTS',
+                 ]
+BinPackArguments: false
+BinPackParameters: false
+BreakBeforeConceptDeclarations: true
+BreakInheritanceList: BeforeColon
+EmptyLineAfterAccessModifier: Never
+EmptyLineBeforeAccessModifier: Always
+IndentWrappedFunctionNames: false
+IndentRequires: true
+InsertTrailingCommas: Wrapped
+KeepEmptyLinesAtTheStartOfBlocks: false
+MaxEmptyLinesToKeep: 1
+PackConstructorInitializers: NextLine
+
+PenaltyIndentedWhitespace: 2
+
+Standard: c++20
+SpacesInAngles: Leave
 
 AlwaysBreakTemplateDeclarations: true
 PointerAlignment: Left
 
-# Disable formatting options which may break tests.
-SortIncludes: false
-ReflowComments: false
 
+# libc++'s preferred indentions of preprocessor statements.
 IndentPPDirectives: AfterHash
 
 # libc++ has some long names so we need more than the 80 column limit imposed by LLVM style, for sensible formatting



More information about the libcxx-commits mailing list