aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseDeclCXX.cpp
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-12-20 23:57:46 +0000
committerDouglas Gregor <dgregor@apple.com>2010-12-20 23:57:46 +0000
commita04426c5416f22df1078f6b31c1619de73c40b59 (patch)
tree5456cc6bdf1f902f60cc9b5f6a29dfe8f8c179ef /lib/Parse/ParseDeclCXX.cpp
parent7ca7ac40ad45d5253ba474dddfa5ee233f35c2fe (diff)
Extend the parser to support pack expansions within exception
specifications. We can't yet instantiate them, however, since I tripped over PR8835. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@122292 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseDeclCXX.cpp')
-rw-r--r--lib/Parse/ParseDeclCXX.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Parse/ParseDeclCXX.cpp b/lib/Parse/ParseDeclCXX.cpp
index a2c87f85c3..e1f7f7bdc5 100644
--- a/lib/Parse/ParseDeclCXX.cpp
+++ b/lib/Parse/ParseDeclCXX.cpp
@@ -1875,8 +1875,8 @@ Parser::MemInitResult Parser::ParseMemInitializer(Decl *ConstructorDecl) {
/// [MS] 'throw' '(' '...' ')'
///
/// type-id-list:
-/// type-id
-/// type-id-list ',' type-id
+/// type-id ... [opt]
+/// type-id-list ',' type-id ... [opt]
///
bool Parser::ParseExceptionSpecification(SourceLocation &EndLoc,
llvm::SmallVectorImpl<ParsedType>
@@ -1908,10 +1908,21 @@ bool Parser::ParseExceptionSpecification(SourceLocation &EndLoc,
SourceRange Range;
while (Tok.isNot(tok::r_paren)) {
TypeResult Res(ParseTypeName(&Range));
+
+ if (Tok.is(tok::ellipsis)) {
+ // C++0x [temp.variadic]p5:
+ // - In a dynamic-exception-specification (15.4); the pattern is a
+ // type-id.
+ SourceLocation Ellipsis = ConsumeToken();
+ if (!Res.isInvalid())
+ Res = Actions.ActOnPackExpansion(Res.get(), Ellipsis);
+ }
+
if (!Res.isInvalid()) {
Exceptions.push_back(Res.get());
Ranges.push_back(Range);
}
+
if (Tok.is(tok::comma))
ConsumeToken();
else