aboutsummaryrefslogtreecommitdiff
path: root/lib/Format
diff options
context:
space:
mode:
authorManuel Klimek <klimek@google.com>2013-01-11 18:13:04 +0000
committerManuel Klimek <klimek@google.com>2013-01-11 18:13:04 +0000
commit606e07ecc0b7b0e01d23baa833b4b4c73af0d4f4 (patch)
tree119092defc4c073140e23e8b1eeb5ccf42e317f8 /lib/Format
parent517e894c56211f57c487bdaba8ead0edc84396fe (diff)
Fix parsing of initializer lists with elaborated type specifier.
Now we correctly parse and format: verifyFormat("struct foo a = { bar }; int n; git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172229 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format')
-rw-r--r--lib/Format/UnwrappedLineParser.cpp10
-rw-r--r--lib/Format/UnwrappedLineParser.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/lib/Format/UnwrappedLineParser.cpp b/lib/Format/UnwrappedLineParser.cpp
index f7332ee770..758f8193ca 100644
--- a/lib/Format/UnwrappedLineParser.cpp
+++ b/lib/Format/UnwrappedLineParser.cpp
@@ -319,7 +319,7 @@ void UnwrappedLineParser::parseStructuralElement() {
return;
case tok::kw_struct: // fallthrough
case tok::kw_class:
- parseStructOrClass();
+ parseStructClassOrBracedList();
return;
case tok::semi:
nextToken();
@@ -565,7 +565,7 @@ void UnwrappedLineParser::parseEnum() {
} while (!eof());
}
-void UnwrappedLineParser::parseStructOrClass() {
+void UnwrappedLineParser::parseStructClassOrBracedList() {
nextToken();
do {
switch (FormatTok.Tok.getKind()) {
@@ -578,6 +578,12 @@ void UnwrappedLineParser::parseStructOrClass() {
nextToken();
addUnwrappedLine();
return;
+ case tok::equal:
+ nextToken();
+ if (FormatTok.Tok.is(tok::l_brace)) {
+ parseBracedList();
+ }
+ break;
default:
nextToken();
break;
diff --git a/lib/Format/UnwrappedLineParser.h b/lib/Format/UnwrappedLineParser.h
index 837b5391f6..cfd0608ba2 100644
--- a/lib/Format/UnwrappedLineParser.h
+++ b/lib/Format/UnwrappedLineParser.h
@@ -146,7 +146,7 @@ private:
void parseNamespace();
void parseAccessSpecifier();
void parseEnum();
- void parseStructOrClass();
+ void parseStructClassOrBracedList();
void parseObjCProtocolList();
void parseObjCUntilAtEnd();
void parseObjCInterfaceOrImplementation();