[libcxx-commits] [libcxx] e7c72d6 - [libc++] Find a clang-format everybody is happy with

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jun 14 11:12:41 PDT 2022


Author: Nikolas Klauser
Date: 2022-06-14T20:12:33+02:00
New Revision: e7c72d69ac0d504f52bed643b298b50904c6b387

URL: https://github.com/llvm/llvm-project/commit/e7c72d69ac0d504f52bed643b298b50904c6b387
DIFF: https://github.com/llvm/llvm-project/commit/e7c72d69ac0d504f52bed643b298b50904c6b387.diff

LOG: [libc++] Find a clang-format everybody is happy with

We decided that we want to use clang-format for libc++ but we haven't decided yet how the code should be formatted. We should probably discuss things on discord. This PR is mostly to show how the clang-format would look like and to commit to one once we decided on it. I'll remove the `<string>` diff when I commit this PR.

Reviewed By: ldionne

Spies: EricWF, dschuff, krytarowski, fedor.sergeev, aheejin, mstorsjo, phosek, abrachet, libcxx-commits, arichardson

Differential Revision: https://reviews.llvm.org/D124789

Added: 
    

Modified: 
    libcxx/.clang-format

Removed: 
    


################################################################################
diff  --git a/libcxx/.clang-format b/libcxx/.clang-format
index 68f0d65e7ba4..6dd752a7c0ab 100644
--- a/libcxx/.clang-format
+++ b/libcxx/.clang-format
@@ -1,5 +1,75 @@
 BasedOnStyle: LLVM
 
+AlignAfterOpenBracket: Align
+AlignConsecutiveAssignments: Consecutive
+AlignConsecutiveBitFields: Consecutive
+AlignEscapedNewlines: Right
+AlignOperands: AlignAfterOperator
+AlignTrailingComments: true
+AllowAllArgumentsOnNextLine: true
+AllowAllParametersOfDeclarationOnNextLine: true
+AllowShortFunctionsOnASingleLine: true
+AllowShortLambdasOnASingleLine: All
+AttributeMacros: ['_LIBCPP_HIDE_FROM_ABI',
+                  '_LIBCPP_CONSTEXPR',
+                  '_LIBCPP_CONSTEXPR_AFTER_CXX11',
+                  '_LIBCPP_CONSTEXPR_AFTER_CXX14',
+                  '_LIBCPP_CONSTEXPR_AFTER_CXX17',
+                  '_LIBCPP_CONSTEXPR_AFTER_CXX20',
+                  '_LIBCPP_ALIGNOF',
+                  '_ALIGNAS_TYPE',
+                  '_ALIGNAS',
+                  '_LIBCPP_NORETURN',
+                  '_LIBCPP_ALWAYS_INLINE',
+                  '_LIBCPP_DISABLE_EXTENTSION_WARNING',
+                  '_LIBCPP_HIDDEN',
+                  '_LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS',
+                  '_LIBCPP_FUNC_VIS',
+                  '_LIBCPP_TYPE_VIS',
+                  '_LIBCPP_TEMPLATE_VIS',
+                  '_LIBCPP_TEMPLATE_DATA_VIS',
+                  '_LIBCPP_EXPORTED_FROM_ABI',
+                  '_LIBCPP_OVERRIDABLE_FUNC_VIS',
+                  '_LIBCPP_EXCEPTION_ABI',
+                  '_LIBCPP_ENUM_VIS',
+                  '_LIBCPP_EXTERN_TEMPLATE_TYPE_VIS',
+                  '_LIBCPP_INTERNAL_LINKAGE',
+                  '_LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION',
+                  '_LIBCPP_HIDE_FROM_ABI_AFTER_V1',
+                  '_LIBCPP_INLINE_VISIBILITY',
+                  '_LIBCPP_CONSTEVAL',
+                  '_LIBCPP_NOALIAS',
+                  '_LIBCPP_USING_IF_EXISTS',
+                  '_LIBCPP_DEPRECATED',
+                  '_LIBCPP_DEPRECATED_IN_CXX11',
+                  '_LIBCPP_DEPRECATED_IN_CXX14',
+                  '_LIBCPP_DEPRECATED_IN_CXX17',
+                  '_LIBCPP_DEPRECATED_IN_CXX20',
+                  '_LIBCPP_NODISCARD',
+                  '_LIBCPP_NODISCARD_EXT',
+                  '_LIBCPP_NO_DESTROY',
+                  '_LIBCPP_WEAK',
+                  '_LIBCPP_CONSTINIT',
+                  '_LIBCPP_FALLTHROUGH',
+                  '_LIBCPP_STANDALONE_DEBUG',
+                  '_LIBCPP_NO_UNIQUE_ADDRESS',
+                 ]
+BinPackArguments: false
+BinPackParameters: false
+BreakBeforeConceptDeclarations: true
+BreakInheritanceList: BeforeColon
+EmptyLineAfterAccessModifier: Never
+EmptyLineBeforeAccessModifier: Always
+IndentWrappedFunctionNames: false
+IndentRequires: true
+InsertTrailingCommas: Wrapped
+KeepEmptyLinesAtTheStartOfBlocks: false
+MaxEmptyLinesToKeep: 1
+NamespaceIndentation: Inner
+PackConstructorInitializers: NextLine
+
+PenaltyIndentedWhitespace: 61
+
 ---
 Language: Cpp
 Standard: c++20


        


More information about the libcxx-commits mailing list