summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-01-09 07:06:56 +0000
committerDaniel Jasper <djasper@google.com>2013-01-09 07:06:56 +0000
commit399d24bc7dfc293b5ec5ee45b66f951a48b964c5 (patch)
tree831536060824a128adf75ef176496dff7bbf17eb /clang/unittests/Format/FormatTest.cpp
parent3f5825c6c1e9d3740451a8cd179ec8dd438d9f73 (diff)
downloadbcm5719-llvm-399d24bc7dfc293b5ec5ee45b66f951a48b964c5.tar.gz
bcm5719-llvm-399d24bc7dfc293b5ec5ee45b66f951a48b964c5.zip
Improve formatting of conditional operators.
This addresses llvm.org/PR14864. We used to completely mess this up and now format as: Diag(NewFD->getLocation(), getLangOpts().MicrosoftExt ? diag::ext_function_specialization_in_class : diag::err_function_specialization_in_class) << NewFD->getDeclName(); llvm-svn: 171957
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index d280f1dc6cb..9bf3097a5c1 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -759,6 +759,15 @@ TEST_F(FormatTest, AlignsAfterReturn) {
" aaaaaaaaaaaaaaaaaaaaaaaaa);");
}
+TEST_F(FormatTest, BreaksConditionalExpressions) {
+ verifyFormat(
+ "aaaa(aaaaaaaaaaaaaaaaaaaa,\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaa ? aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa :\n"
+ " aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa);");
+ verifyFormat("aaaa(aaaaaaaaaaaaaaaaaaaa, aaaaaaaaaaaaaaaaaaaaaaaaaa ?\n"
+ " aaaaaaaaaaaaaaaaaaaaaaa : aaaaaaaaaaaaaaaaaaaaa);");
+}
+
TEST_F(FormatTest, AlignsStringLiterals) {
verifyFormat("loooooooooooooooooooooooooongFunction(\"short literal \"\n"
" \"short literal\");");
OpenPOWER on IntegriCloud