summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-07-11 21:02:56 +0000
committerDaniel Jasper <djasper@google.com>2013-07-11 21:02:56 +0000
commit718bd366cf85d9f24a839ce09c01d44de21ad058 (patch)
tree398ae7ec5173917eddca1f37592cf2eef937167d /clang/unittests/Format/FormatTest.cpp
parentdb06b139fde5c1eea931b5bed35da589b8f430e2 (diff)
downloadbcm5719-llvm-718bd366cf85d9f24a839ce09c01d44de21ad058.tar.gz
bcm5719-llvm-718bd366cf85d9f24a839ce09c01d44de21ad058.zip
clang-format: Break before trailing annotations.
(if they are not function-like). Before: SomeFunction(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa) OVERRIDE; After: SomeFunction(aaaaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaa) OVERRIDE; llvm-svn: 186117
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index c99d2ae7d34..ae4d9f5c0d9 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -2482,6 +2482,7 @@ TEST_F(FormatTest, TrailingReturnType) {
}
TEST_F(FormatTest, BreaksFunctionDeclarationsWithTrailingTokens) {
+ // Avoid breaking before trailing 'const'.
verifyFormat("void someLongFunction(\n"
" int someLongParameter) const {}",
getLLVMStyleWithColumns(46));
@@ -2500,6 +2501,13 @@ TEST_F(FormatTest, BreaksFunctionDeclarationsWithTrailingTokens) {
" const {}",
Style);
+ // Avoid breaking before other trailing annotations, if they are not
+ // function-like.
+ verifyFormat("void SomeFunction(aaaaaaaaaaaaaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaa) OVERRIDE;");
+
+ // Breaking before function-like trailing annotations is fine to keep them
+ // close to their arguments.
verifyFormat("void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa)\n"
" LOCKS_EXCLUDED(aaaaaaaaaaaaa);");
verifyFormat("void aaaaaaaaaaaa(int aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa) const\n"
OpenPOWER on IntegriCloud