]> granicus.if.org Git - clang/commitdiff
Patch to diagnose use of objc's @defs in nonfragile abi.
authorFariborz Jahanian <fjahanian@apple.com>
Tue, 21 Apr 2009 20:28:41 +0000 (20:28 +0000)
committerFariborz Jahanian <fjahanian@apple.com>
Tue, 21 Apr 2009 20:28:41 +0000 (20:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69710 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticSemaKinds.td
lib/Sema/SemaDeclObjC.cpp
test/SemaObjC/sizeof-interface.m

index f264de4d0cb4461f8d9eaea87c638e9f7e4cb39c..94602071ae25e7ed34d52c05249e438705f260e4 100644 (file)
@@ -925,6 +925,8 @@ def err_sizeof_forward_interface : Error<
 def err_sizeof_nonfragile_interface : Error<
   "invalid application of '%select{alignof|sizeof}1' to interface %0 in "
   "non-fragile ABI">;
+def err_atdef_nonfragile_interface : Error<
+  "invalid application of @defs in non-fragile ABI">;
 // FIXME: merge with %select
 def err_sizeof_incomplete_type : Error<
   "invalid application of 'sizeof' to an incomplete type %0">;
index 9b5f0d7bb07bedcae7d5b3da89ec52a7dd0edd92..5ab1efec0374af2bd70cb5c501e751f7e861a0b0 100644 (file)
@@ -1975,6 +1975,11 @@ void Sema::ActOnDefs(Scope *S, DeclPtrTy TagD, SourceLocation DeclStart,
     Diag(DeclStart, diag::err_undef_interface) << ClassName;
     return;
   }
+  if (LangOpts.ObjCNonFragileABI) {
+    Diag(DeclStart, diag::err_atdef_nonfragile_interface);
+    return;
+  }
+  
   // Collect the instance variables
   CollectIvars(Class, dyn_cast<RecordDecl>(TagD.getAs<Decl>()), Context, Decls);
   
index 3dae7b9017d15de7e5caeeaab1735d27d7061fde..3bbe18db70234472402f3dad754fd55c397f1ccc 100644 (file)
@@ -33,6 +33,8 @@ int g2[ sizeof(I0)   // expected-error {{invalid application of 'sizeof' to inte
 @synthesize p0 = _p0;
 @end
 
+typedef struct { @defs(I1) } I1_defs; // expected-error {{invalid application of @defs in non-fragile ABI}}
+
 // FIXME: This is currently broken due to the way the record layout we
 // create is tied to whether we have seen synthesized properties. Ugh.
 // int g3[ sizeof(I1) == 0 ? 1 : -1];