It is illegal to derefrercne to an interface in

objc's non-fragile ABI.

llvm-svn: 80739
This commit is contained in:
Fariborz Jahanian 2009-09-02 00:00:05 +00:00
parent 8c7f86e698
commit 086ac11606
2 changed files with 11 additions and 2 deletions

View File

@ -1355,6 +1355,8 @@ def err_typecheck_unary_expr : Error<
"invalid argument type %0 to unary expression">; "invalid argument type %0 to unary expression">;
def err_typecheck_indirection_requires_pointer : Error< def err_typecheck_indirection_requires_pointer : Error<
"indirection requires pointer operand (%0 invalid)">; "indirection requires pointer operand (%0 invalid)">;
def err_indirection_requires_nonfragile_object : Error<
"indirection cannot be to an interface in non-fragile ABI (%0 invalid)">;
def err_typecheck_invalid_operands : Error< def err_typecheck_invalid_operands : Error<
"invalid operands to binary expression (%0 and %1)">; "invalid operands to binary expression (%0 and %1)">;
def err_typecheck_sub_ptr_object : Error< def err_typecheck_sub_ptr_object : Error<

View File

@ -5023,8 +5023,15 @@ QualType Sema::CheckIndirectionOperand(Expr *Op, SourceLocation OpLoc) {
if (const PointerType *PT = Ty->getAs<PointerType>()) if (const PointerType *PT = Ty->getAs<PointerType>())
return PT->getPointeeType(); return PT->getPointeeType();
if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType()) if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType()) {
return OPT->getPointeeType(); QualType PTy = OPT->getPointeeType();
if (LangOpts.ObjCNonFragileABI && PTy->isObjCInterfaceType()) {
Diag(OpLoc, diag::err_indirection_requires_nonfragile_object)
<< Ty << Op->getSourceRange();
return QualType();
}
return PTy;
}
Diag(OpLoc, diag::err_typecheck_indirection_requires_pointer) Diag(OpLoc, diag::err_typecheck_indirection_requires_pointer)
<< Ty << Op->getSourceRange(); << Ty << Op->getSourceRange();