summaryrefslogtreecommitdiffstats
path: root/clang/unittests
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2017-06-19 07:45:41 +0000
committerDaniel Jasper <djasper@google.com>2017-06-19 07:45:41 +0000
commitf92659e4ea0196d081ff714220e004f63d7fc5ef (patch)
treef504a332dc864c5e8f2dc7b801a31ebaed805dbd /clang/unittests
parent6a7d5a7a22a6522e0bfb7e60b3a15acb2eed2f60 (diff)
downloadbcm5719-llvm-f92659e4ea0196d081ff714220e004f63d7fc5ef.tar.gz
bcm5719-llvm-f92659e4ea0196d081ff714220e004f63d7fc5ef.zip
clang-format: Improve understanding of combined typedef+record declarations
Fixes an issue where struct A { int X; }; would be broken onto multiple lines, but typedef struct A { int X; } A2; was collapsed onto a single line. Patch by Jacob Bandes-Storch. Thank you. llvm-svn: 305667
Diffstat (limited to 'clang/unittests')
-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 e6cd617abd8..bae7fba0a60 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -458,6 +458,14 @@ TEST_F(FormatTest, FormatShortBracedStatements) {
"}",
AllowSimpleBracedStatements);
+ verifyFormat("struct A2 {\n"
+ " int X;\n"
+ "};",
+ AllowSimpleBracedStatements);
+ verifyFormat("typedef struct A2 {\n"
+ " int X;\n"
+ "} A2_t;",
+ AllowSimpleBracedStatements);
verifyFormat("template <int> struct A2 {\n"
" struct B {};\n"
"};",
OpenPOWER on IntegriCloud