aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-12 23:26:56 +0000
committerChris Lattner <sabre@nondot.org>2009-04-12 23:26:56 +0000
commit93c4945c9ead2d374fe3fc528e3017c7167265be (patch)
treee72101b0ec15fbe760e2700361e9ec8e1bf5275c
parentb6688e02d2cea9a1e2519654133ac2aa81fd8055 (diff)
if we already know that a decl is invalid in an @catch, don't verify its type.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68925 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaStmt.cpp6
-rw-r--r--test/SemaObjC/exception-go-boom.m3
2 files changed, 6 insertions, 3 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 1428c48847..a34fc2410e 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -1031,6 +1031,10 @@ Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
// PVD == 0 implies @catch(...).
if (PVD) {
+ // If we already know the decl is invalid, reject it.
+ if (PVD->isInvalidDecl())
+ return StmtError();
+
if (!Context.isObjCObjectPointerType(PVD->getType()))
return StmtError(Diag(PVD->getLocation(),
diag::err_catch_param_not_objc_type));
@@ -1038,7 +1042,7 @@ Sema::ActOnObjCAtCatchStmt(SourceLocation AtLoc,
return StmtError(Diag(PVD->getLocation(),
diag::err_illegal_qualifiers_on_catch_parm));
}
-
+
ObjCAtCatchStmt *CS = new (Context) ObjCAtCatchStmt(AtLoc, RParen,
PVD, static_cast<Stmt*>(Body.release()), CatchList);
return Owned(CatchList ? CatchList : CS);
diff --git a/test/SemaObjC/exception-go-boom.m b/test/SemaObjC/exception-go-boom.m
index 774ae7cd63..5e5f58eeb1 100644
--- a/test/SemaObjC/exception-go-boom.m
+++ b/test/SemaObjC/exception-go-boom.m
@@ -4,8 +4,7 @@
void f0(id x) {
@try {
} @catch (NSException *x) { // \
- expected-error{{unknown type name 'NSException'}} \
- expected-error{{@catch parameter is not a pointer to an interface type}}
+ expected-error{{unknown type name 'NSException'}}
}
}