diff options
author | Manuel Klimek <klimek@google.com> | 2013-01-21 19:17:52 +0000 |
---|---|---|
committer | Manuel Klimek <klimek@google.com> | 2013-01-21 19:17:52 +0000 |
commit | 308232c0aef773d24693f9e456dc3bc983934f7f (patch) | |
tree | 441a512bee7f7a452c664800ca3f0d16737e2e45 /unittests/Format/FormatTest.cpp | |
parent | aabd094cf694039fe823987e133af7ac25cb9711 (diff) |
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;
}
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173075 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'unittests/Format/FormatTest.cpp')
-rw-r--r-- | unittests/Format/FormatTest.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp index bda3196b02..c9b255ce41 100644 --- a/unittests/Format/FormatTest.cpp +++ b/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) { |