[libcxx-commits] [libcxxabi] [libc++abi] Use the same .clang-format as libc++ (PR #208661)
Nikolas Klauser via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Jul 10 01:48:45 PDT 2026
https://github.com/philnik777 created https://github.com/llvm/llvm-project/pull/208661
libc++abi is very close to libc++, and even shares some amount of code. We should keep the formatting style the same between the two libraries.
>From 18f60e986f427f89ae83c4a0cb299a9aed903378 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++
---
libcxxabi/.clang-format | 75 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 71 insertions(+), 4 deletions(-)
diff --git a/libcxxabi/.clang-format b/libcxxabi/.clang-format
index b4f56c0de9819..9a455d304eb56 100644
--- a/libcxxabi/.clang-format
+++ b/libcxxabi/.clang-format
@@ -1,14 +1,81 @@
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
+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