[cfe-commits] r64670 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/attr-deprecated.m
Chris Lattner
sabre at nondot.org
Mon Feb 16 13:30:01 PST 2009
Author: lattner
Date: Mon Feb 16 15:30:01 2009
New Revision: 64670
URL: http://llvm.org/viewvc/llvm-project?rev=64670&view=rev
Log:
warn about categories that implement deprecated interfaces.
Modified:
cfe/trunk/lib/Sema/SemaDeclObjC.cpp
cfe/trunk/test/SemaObjC/attr-deprecated.m
Modified: cfe/trunk/lib/Sema/SemaDeclObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclObjC.cpp?rev=64670&r1=64669&r2=64670&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Feb 16 15:30:01 2009
@@ -263,12 +263,7 @@
continue;
}
- if (PDecl->getAttr<UnavailableAttr>())
- Diag(ProtocolId[i].second, diag::warn_unavailable) <<
- PDecl->getDeclName();
- if (PDecl->getAttr<DeprecatedAttr>())
- Diag(ProtocolId[i].second, diag::warn_deprecated) <<
- PDecl->getDeclName();
+ DiagnoseUseOfDeprecatedDeclImpl(PDecl, ProtocolId[i].second);
// If this is a forward declaration and we are supposed to warn in this
// case, do it.
@@ -489,6 +484,9 @@
}
CDecl->setClassInterface(IDecl);
+
+ // If the interface is deprecated, warn about it.
+ DiagnoseUseOfDeprecatedDeclImpl(IDecl, ClassLoc);
/// Check for duplicate interface declaration for this category
ObjCCategoryDecl *CDeclChain;
Modified: cfe/trunk/test/SemaObjC/attr-deprecated.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-deprecated.m?rev=64670&r1=64669&r2=64670&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-deprecated.m (original)
+++ cfe/trunk/test/SemaObjC/attr-deprecated.m Mon Feb 16 15:30:01 2009
@@ -81,3 +81,14 @@
return f.FooBar; // expected-warning {{warning: 'FooBar' is deprecated}}
}
+
+__attribute ((deprecated))
+ at interface DEPRECATED {
+ @public int ivar;
+}
+- (int) instancemethod;
+ at property int prop;
+ at end
+
+ at interface DEPRECATED (Category) // expected-warning {{warning: 'DEPRECATED' is deprecated}}
+ at end
More information about the cfe-commits
mailing list