summaryrefslogtreecommitdiffstats
path: root/clang/unittests/Format/FormatTest.cpp
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-21 19:17:52 +0000
committerManuel Klimek <klimek@google.com>2013-01-21 19:17:52 +0000
commit2cec01916c47a097f8777c85c22e66a88b684949 (patch)
tree1521b061e709df2846fa790678a8b4bd73703aba /clang/unittests/Format/FormatTest.cpp
parent085c5450d9f22e48d9440811fe94e627ff3b20df (diff)
downloadbcm5719-llvm-2cec01916c47a097f8777c85c22e66a88b684949.tar.gz
bcm5719-llvm-2cec01916c47a097f8777c85c22e66a88b684949.zip
Fixes various problems around enum parsing.
Very similar to what we do for record definitions: - tighten down what is an enum definition, so that we don't mistake a function for an enum - allow common idioms around declarations (we'll want to handle that more centrally in the future) We now correctly format: enum X f() { a(); return 42; } llvm-svn: 173075
Diffstat (limited to 'clang/unittests/Format/FormatTest.cpp')
-rw-r--r--clang/unittests/Format/FormatTest.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index bda3196b02a..c9b255ce414 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -499,6 +499,10 @@ TEST_F(FormatTest, FormatsEnum) {
"};");
verifyFormat("enum {\n"
"};");
+ verifyFormat("enum X E {\n} d;");
+ verifyFormat("enum __attribute__((...)) E {\n} d;");
+ verifyFormat("enum __declspec__((...)) E {\n} d;");
+ verifyFormat("enum X f() {\n a();\n return 42;\n}");
}
TEST_F(FormatTest, FormatsBitfields) {
OpenPOWER on IntegriCloud