]> granicus.if.org Git - clang/commitdiff
It is illegal to derefrercne to an interface in
authorFariborz Jahanian <fjahanian@apple.com>
Wed, 2 Sep 2009 00:00:05 +0000 (00:00 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Wed, 2 Sep 2009 00:00:05 +0000 (00:00 +0000)
objc's non-fragile ABI.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80739 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaExpr.cpp

index 5e9c7486d34b5c505df7df1c82d9e8e2658e903d..e29e6ab4c773963ba18ddb483fbef767e23891da 100644 (file)
@@ -1355,6 +1355,8 @@ def err_typecheck_unary_expr : Error<
   "invalid argument type %0 to unary expression">;
 def err_typecheck_indirection_requires_pointer : Error<
   "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<
   "invalid operands to binary expression (%0 and %1)">;
 def err_typecheck_sub_ptr_object : Error<
index c01097e363c11707ed951962c416d53f548aa07d..7072443829a25613967471c0c9fbe5f10fcc499e 100644 (file)
@@ -5023,8 +5023,15 @@ QualType Sema::CheckIndirectionOperand(Expr *Op, SourceLocation OpLoc) {
   if (const PointerType *PT = Ty->getAs<PointerType>())
     return PT->getPointeeType();
 
-  if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType())
-    return OPT->getPointeeType();
+  if (const ObjCObjectPointerType *OPT = Ty->getAsObjCObjectPointerType()) {
+    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)
     << Ty << Op->getSourceRange();