summaryrefslogtreecommitdiffstats
path: root/clang/lib/Parse/ParseObjc.cpp
diff options
context:
space:
mode:
authorSteve Naroff <snaroff@apple.com>2009-03-03 19:52:17 +0000
committerSteve Naroff <snaroff@apple.com>2009-03-03 19:52:17 +0000
commit371b8fb4c3083ba22908b0c2f9ae77a3eeb67487 (patch)
tree3c977f6bfe05be733b1135455e1735ee3e333f26 /clang/lib/Parse/ParseObjc.cpp
parent530e03894095ee791c9ed8d3c9d6e4f0bf685d7c (diff)
downloadbcm5719-llvm-371b8fb4c3083ba22908b0c2f9ae77a3eeb67487.tar.gz
bcm5719-llvm-371b8fb4c3083ba22908b0c2f9ae77a3eeb67487.zip
Fix <rdar://problem/6640991> Exception handling executes wrong clause (Daniel, please verify).
Also necessary to fix: <rdar://problem/6632061> [sema] non object types should not be allowed in @catch statements <rdar://problem/6252237> [sema] qualified id should be disallowed in @catch statements llvm-svn: 65964
Diffstat (limited to 'clang/lib/Parse/ParseObjc.cpp')
-rw-r--r--clang/lib/Parse/ParseObjc.cpp23
1 files changed, 10 insertions, 13 deletions
diff --git a/clang/lib/Parse/ParseObjc.cpp b/clang/lib/Parse/ParseObjc.cpp
index 193a73f664d..3637d144d63 100644
--- a/clang/lib/Parse/ParseObjc.cpp
+++ b/clang/lib/Parse/ParseObjc.cpp
@@ -1285,7 +1285,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
SourceLocation AtCatchFinallyLoc = ConsumeToken();
if (Tok.isObjCAtKeyword(tok::objc_catch)) {
- OwningStmtResult FirstPart(Actions);
+ DeclTy *FirstPart = 0;
ConsumeToken(); // consume catch
if (Tok.is(tok::l_paren)) {
ConsumeParen();
@@ -1294,17 +1294,14 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
DeclSpec DS;
ParseDeclarationSpecifiers(DS);
// 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);
- if (DeclaratorInfo.getIdentifier()) {
- DeclTy *aBlockVarDecl = Actions.ActOnDeclarator(CurScope,
- DeclaratorInfo, 0);
- FirstPart =
- Actions.ActOnDeclStmt(aBlockVarDecl,
- DS.getSourceRange().getBegin(),
- DeclaratorInfo.getSourceRange().getEnd());
- }
+ // optional. As a result, we need to use "PrototypeContext", because
+ // we must accept either 'declarator' or 'abstract-declarator' here.
+ Declarator ParmDecl(DS, Declarator::PrototypeContext);
+ ParseDeclarator(ParmDecl);
+
+ // Inform the actions module about the parameter declarator, so it
+ // gets added to the current scope.
+ FirstPart = Actions.ActOnParamDeclarator(CurScope, ParmDecl);
} else
ConsumeToken(); // consume '...'
SourceLocation RParenLoc = ConsumeParen();
@@ -1317,7 +1314,7 @@ Parser::OwningStmtResult Parser::ParseObjCTryStmt(SourceLocation atLoc) {
if (CatchBody.isInvalid())
CatchBody = Actions.ActOnNullStmt(Tok.getLocation());
CatchStmts = Actions.ActOnObjCAtCatchStmt(AtCatchFinallyLoc,
- RParenLoc, move(FirstPart), move(CatchBody),
+ RParenLoc, FirstPart, move(CatchBody),
move(CatchStmts));
} else {
Diag(AtCatchFinallyLoc, diag::err_expected_lparen_after)
OpenPOWER on IntegriCloud