aboutsummaryrefslogtreecommitdiff
path: root/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2008-06-03 05:36:54 +0000
committerSteve Naroff <snaroff@apple.com>2008-06-03 05:36:54 +0000
commit459a1e2212115f4ff89db7f444df5af41792b18a (patch)
tree49903083873585611d644827744af724d82d247a /lib/Parse/ParseObjc.cpp
parente3e9add4fd788927df6f545570e7838db59c01d7 (diff)
Fix parser bug/FIXME with @catch.
<rdar://problem/5980846> clang on xcode: error: declarator requires an identifier (for @catch) git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@51895 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Parse/ParseObjc.cpp')
-rw-r--r--lib/Parse/ParseObjc.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/lib/Parse/ParseObjc.cpp b/lib/Parse/ParseObjc.cpp
index 6a07503737..933a7a606c 100644
--- a/lib/Parse/ParseObjc.cpp
+++ b/lib/Parse/ParseObjc.cpp
@@ -1193,15 +1193,19 @@ Parser::StmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
if (Tok.isNot(tok::ellipsis)) {
DeclSpec DS;
ParseDeclarationSpecifiers(DS);
- // FIXME: Is BlockContext right?
- Declarator DeclaratorInfo(DS, Declarator::BlockContext);
+ // For some odd reason, the name of the exception variable is
+ // optional. As a result, we need to use PrototypeContext.
+ Declarator DeclaratorInfo(DS, Declarator::PrototypeContext);
ParseDeclarator(DeclaratorInfo);
- DeclTy *aBlockVarDecl = Actions.ActOnDeclarator(CurScope,
+ if (DeclaratorInfo.getIdentifier()) {
+ DeclTy *aBlockVarDecl = Actions.ActOnDeclarator(CurScope,
DeclaratorInfo, 0);
- StmtResult stmtResult =
- Actions.ActOnDeclStmt(aBlockVarDecl, DS.getSourceRange().getBegin(),
- DeclaratorInfo.getSourceRange().getEnd());
- FirstPart = stmtResult.isInvalid ? 0 : stmtResult.Val;
+ StmtResult stmtResult =
+ Actions.ActOnDeclStmt(aBlockVarDecl,
+ DS.getSourceRange().getBegin(),
+ DeclaratorInfo.getSourceRange().getEnd());
+ FirstPart = stmtResult.isInvalid ? 0 : stmtResult.Val;
+ }
} else
ConsumeToken(); // consume '...'
SourceLocation RParenLoc = ConsumeParen();