From c75e1effed73e1a3f7e9b509634648d71c1dddcf Mon Sep 17 00:00:00 2001 From: Daniel Jasper Date: Wed, 9 Jul 2014 08:42:42 +0000 Subject: clang-format: Add new option to indent wrapped function declarations. Though not completely identical, make former IndentFunctionDeclarationAfterType change this flag for backwards compatibility (it is somewhat close in meaning and better the err'ing on an unknown config flag). llvm-svn: 212597 --- clang/unittests/Format/FormatTest.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'clang/unittests/Format/FormatTest.cpp') diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index 7029b43f05b..150497745b3 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -5082,6 +5082,23 @@ TEST_F(FormatTest, BreaksLongDeclarations) { "LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}"); verifyFormat("decltype(LoooooooooooooooooooooooooooooooooooooooongName)\n" "LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}"); + FormatStyle Indented = getLLVMStyle(); + Indented.IndentWrappedFunctionNames = true; + verifyFormat("LoooooooooooooooooooooooooooooooooooooooongReturnType\n" + " LoooooooooooooooooooooooooooooooongFunctionDeclaration();", + Indented); + verifyFormat( + "LoooooooooooooooooooooooooooooooooooooooongReturnType\n" + " LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}", + Indented); + verifyFormat( + "LoooooooooooooooooooooooooooooooooooooooongReturnType const\n" + " LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}", + Indented); + verifyFormat( + "decltype(LoooooooooooooooooooooooooooooooooooooooongName)\n" + " LooooooooooooooooooooooooooooooooooongFunctionDefinition() {}", + Indented); // FIXME: Without the comment, this breaks after "(". verifyFormat("LoooooooooooooooooooooooooooooooooooooooongType // break\n" @@ -8103,6 +8120,7 @@ TEST_F(FormatTest, ParsesConfiguration) { CHECK_PARSE_BOOL(ConstructorInitializerAllOnOneLineOrOnePerLine); CHECK_PARSE_BOOL(DerivePointerAlignment); CHECK_PARSE_BOOL(IndentCaseLabels); + CHECK_PARSE_BOOL(IndentWrappedFunctionNames); CHECK_PARSE_BOOL(KeepEmptyLinesAtTheStartOfBlocks); CHECK_PARSE_BOOL(ObjCSpaceAfterProperty); CHECK_PARSE_BOOL(ObjCSpaceBeforeProtocolList); -- cgit v1.2.3