[cfe-commits] r59743 - in /cfe/trunk: lib/Sema/SemaDeclAttr.cpp test/SemaObjC/warn-weak-field.m
Fariborz Jahanian
fjahanian at apple.com
Thu Nov 20 11:35:52 PST 2008
Author: fjahanian
Date: Thu Nov 20 13:35:51 2008
New Revision: 59743
URL: http://llvm.org/viewvc/llvm-project?rev=59743&view=rev
Log:
__weak ivar need not warn.
Modified:
cfe/trunk/lib/Sema/SemaDeclAttr.cpp
cfe/trunk/test/SemaObjC/warn-weak-field.m
Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=59743&r1=59742&r2=59743&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Thu Nov 20 13:35:51 2008
@@ -556,7 +556,7 @@
ObjCGCAttr::GCAttrTypes type;
if (Attr.getParameterName()->isStr("weak")) {
- if (isa<FieldDecl>(d))
+ if (isa<FieldDecl>(d) && !isa<ObjCIvarDecl>(d))
S.Diag(Attr.getLoc(), diag::warn_attribute_weak_on_field);
type = ObjCGCAttr::Weak;
}
Modified: cfe/trunk/test/SemaObjC/warn-weak-field.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/warn-weak-field.m?rev=59743&r1=59742&r2=59743&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/warn-weak-field.m (original)
+++ cfe/trunk/test/SemaObjC/warn-weak-field.m Thu Nov 20 13:35:51 2008
@@ -5,6 +5,17 @@
__strong id p1;
};
+ at interface I
+{
+ __weak id w; // OK
+ __strong id LHS;
+}
+- (void) foo;
+ at end
+ at implementation I
+- (void) foo { w = 0; LHS = w; }
+ at end
+
int main ()
{
struct I {
More information about the cfe-commits
mailing list