summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2018-05-20 19:26:44 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2018-05-20 19:26:44 +0000
commit278e1c460b2de9fbd425986416875d5bc2206e6c (patch)
treeff46afd8cf9ad07a357eabfd824f2fb7e0e93197 /clang/lib
parent777afc7fbd903f21ba575c800172bca779e264ff (diff)
downloadbcm5719-llvm-278e1c460b2de9fbd425986416875d5bc2206e6c.tar.gz
bcm5719-llvm-278e1c460b2de9fbd425986416875d5bc2206e6c.zip
Sema: diagnose invalid catch parameter in ObjC
Ensure that the type being used has an associated interface when declaring the parameter for `@catch`. Resolves PR37384! llvm-svn: 332821
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaDeclObjC.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaDeclObjC.cpp b/clang/lib/Sema/SemaDeclObjC.cpp
index 87d37e68257..d7544ecfaf7 100644
--- a/clang/lib/Sema/SemaDeclObjC.cpp
+++ b/clang/lib/Sema/SemaDeclObjC.cpp
@@ -4838,12 +4838,17 @@ VarDecl *Sema::BuildObjCExceptionDecl(TypeSourceInfo *TInfo, QualType T,
// Don't do any further checking.
} else if (T->isDependentType()) {
// Okay: we don't know what this type will instantiate to.
- } else if (!T->isObjCObjectPointerType()) {
- Invalid = true;
- Diag(IdLoc ,diag::err_catch_param_not_objc_type);
} else if (T->isObjCQualifiedIdType()) {
Invalid = true;
Diag(IdLoc, diag::err_illegal_qualifiers_on_catch_parm);
+ } else if (T->isObjCIdType()) {
+ // Okay: we don't know what this type will instantiate to.
+ } else if (!T->isObjCObjectPointerType()) {
+ Invalid = true;
+ Diag(IdLoc, diag::err_catch_param_not_objc_type);
+ } else if (!T->getAs<ObjCObjectPointerType>()->getInterfaceType()) {
+ Invalid = true;
+ Diag(IdLoc, diag::err_catch_param_not_objc_type);
}
VarDecl *New = VarDecl::Create(Context, CurContext, StartLoc, IdLoc, Id,
OpenPOWER on IntegriCloud