Fix <rdar://problem/6252237> [sema] qualified id should be disallowed in @catch statements.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65969 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp
index 7e7edbe..12db433 100644
--- a/lib/Sema/SemaStmt.cpp
+++ b/lib/Sema/SemaStmt.cpp
@@ -968,9 +968,14 @@
ParmVarDecl *PVD = static_cast<ParmVarDecl*>(Parm);
// PVD == 0 implies @catch(...).
- if (PVD && !Context.isObjCObjectPointerType(PVD->getType()))
- return StmtError(Diag(PVD->getLocation(),
- diag::err_catch_param_not_objc_type));
+ if (PVD) {
+ if (!Context.isObjCObjectPointerType(PVD->getType()))
+ return StmtError(Diag(PVD->getLocation(),
+ diag::err_catch_param_not_objc_type));
+ if (PVD->getType()->isObjCQualifiedIdType())
+ return StmtError(Diag(PVD->getLocation(),
+ diag::warn_ignoring_qualifiers_on_catch_parm));
+ }
ObjCAtCatchStmt *CS = new (Context) ObjCAtCatchStmt(AtLoc, RParen,
PVD, static_cast<Stmt*>(Body.release()), CatchList);