summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/UnwrappedLineParser.cpp
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
commitd5e5f8f2a47246275a34c01c3eb472267eb40f92 (patch)
tree47dadc2088381bbdc52353c1b94b84a4ee7ebd0e /clang/lib/Format/UnwrappedLineParser.cpp
parent0cb6fd930e1d9b428fbed3244dd971439801b6bb (diff)
downloadbcm5719-llvm-d5e5f8f2a47246275a34c01c3eb472267eb40f92.tar.gz
bcm5719-llvm-d5e5f8f2a47246275a34c01c3eb472267eb40f92.zip
Fix parsing of initializer lists with elaborated type specifier.
Now we correctly parse and format: verifyFormat("struct foo a = { bar }; int n; llvm-svn: 172229
Diffstat (limited to 'clang/lib/Format/UnwrappedLineParser.cpp')
-rw-r--r--clang/lib/Format/UnwrappedLineParser.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/clang/lib/Format/UnwrappedLineParser.cpp b/clang/lib/Format/UnwrappedLineParser.cpp
index f7332ee7707..758f8193ca4 100644
--- a/clang/lib/Format/UnwrappedLineParser.cpp
+++ b/clang/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;
OpenPOWER on IntegriCloud