[cfe-commits] r80739 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp

Fariborz Jahanian fjahanian at apple.com
Tue Sep 1 17:00:05 PDT 2009


Author: fjahanian
Date: Tue Sep  1 19:00:05 2009
New Revision: 80739

URL: http://llvm.org/viewvc/llvm-project?rev=80739&view=rev
Log:
It is illegal to derefrercne to an interface in
objc's non-fragile ABI.

Modified:
    cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
    cfe/trunk/lib/Sema/SemaExpr.cpp

Modified: cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td?rev=80739&r1=80738&r2=80739&view=diff

==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td Tue Sep  1 19:00:05 2009
@@ -1355,6 +1355,8 @@
   "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<

Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=80739&r1=80738&r2=80739&view=diff

==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Tue Sep  1 19:00:05 2009
@@ -5023,8 +5023,15 @@
   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();





More information about the cfe-commits mailing list