diff options
| author | Daniel Jasper <djasper@google.com> | 2014-08-05 12:16:31 +0000 |
|---|---|---|
| committer | Daniel Jasper <djasper@google.com> | 2014-08-05 12:16:31 +0000 |
| commit | ca4ea1ce595867f2bdcf204064193c36eb242937 (patch) | |
| tree | 10e2c54bb3bab286cef6c3893e1757716803edfc /clang/unittests/Format/FormatTest.cpp | |
| parent | d9670878d46372e402f67372361cd408f98c54ef (diff) | |
| download | bcm5719-llvm-ca4ea1ce595867f2bdcf204064193c36eb242937.tar.gz bcm5719-llvm-ca4ea1ce595867f2bdcf204064193c36eb242937.zip | |
clang-format: Add option to always break after a function's return type.
This is required for GNU coding style, among others.
Also update the configuration documentation.
Modified from an original patch by Jarkko Hietaniemi, thank you!
llvm-svn: 214858
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
| -rw-r--r-- | clang/unittests/Format/FormatTest.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp index e0841caa4c7..74cca4fafbc 100644 --- a/clang/unittests/Format/FormatTest.cpp +++ b/clang/unittests/Format/FormatTest.cpp @@ -4147,6 +4147,17 @@ TEST_F(FormatTest, AlignsStringLiterals) { getLLVMStyleWithColumns(25)); } +TEST_F(FormatTest, AlwaysBreakAfterDefinitionReturnType) { + FormatStyle AfterType = getLLVMStyle(); + AfterType.AlwaysBreakAfterDefinitionReturnType = true; + verifyFormat("const char *\n" + "f(void) {\n" // Break here. + " return \"\";\n" + "}\n" + "const char *bar(void);\n", // No break here. + AfterType); +} + TEST_F(FormatTest, AlwaysBreakBeforeMultilineStrings) { FormatStyle NoBreak = getLLVMStyle(); NoBreak.AlwaysBreakBeforeMultilineStrings = false; @@ -8148,6 +8159,7 @@ TEST_F(FormatTest, ParsesConfiguration) { CHECK_PARSE_BOOL(AllowShortBlocksOnASingleLine); CHECK_PARSE_BOOL(AllowShortIfStatementsOnASingleLine); CHECK_PARSE_BOOL(AllowShortLoopsOnASingleLine); + CHECK_PARSE_BOOL(AlwaysBreakAfterDefinitionReturnType); CHECK_PARSE_BOOL(AlwaysBreakTemplateDeclarations); CHECK_PARSE_BOOL(BinPackParameters); CHECK_PARSE_BOOL(BreakBeforeBinaryOperators); |

