[cfe-commits] r64671 - in /cfe/trunk: lib/Sema/SemaDeclObjC.cpp test/SemaObjC/attr-deprecated.m
Chris Lattner
sabre at nondot.org
Mon Feb 16 13:33:09 PST 2009
Author: lattner
Date: Mon Feb 16 15:33:09 2009
New Revision: 64671
URL: http://llvm.org/viewvc/llvm-project?rev=64671&view=rev
Log:
warn about interfaces that inherit from deprecated classes.
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=64671&r1=64670&r2=64671&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclObjC.cpp Mon Feb 16 15:33:09 2009
@@ -108,6 +108,11 @@
ObjCInterfaceDecl *SuperClassDecl =
dyn_cast_or_null<ObjCInterfaceDecl>(PrevDecl);
+
+ // Diagnose classes that inherit from deprecated classes.
+ if (SuperClassDecl)
+ DiagnoseUseOfDeprecatedDeclImpl(SuperClassDecl, SuperLoc);
+
if (PrevDecl && SuperClassDecl == 0) {
// The previous declaration was not a class decl. Check if we have a
// typedef. If we do, get the underlying class type.
@@ -118,6 +123,7 @@
SuperClassDecl = dyn_cast<ObjCInterfaceDecl>(IDecl);
}
}
+
// This handles the following case:
//
// typedef int SuperClass;
@@ -128,6 +134,7 @@
Diag(PrevDecl->getLocation(), diag::note_previous_definition);
}
}
+
if (!dyn_cast_or_null<TypedefDecl>(PrevDecl)) {
if (!SuperClassDecl)
Diag(SuperLoc, diag::err_undef_superclass)
Modified: cfe/trunk/test/SemaObjC/attr-deprecated.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-deprecated.m?rev=64671&r1=64670&r2=64671&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-deprecated.m (original)
+++ cfe/trunk/test/SemaObjC/attr-deprecated.m Mon Feb 16 15:33:09 2009
@@ -92,3 +92,8 @@
@interface DEPRECATED (Category) // expected-warning {{warning: 'DEPRECATED' is deprecated}}
@end
+
+ at interface NS : DEPRECATED // expected-warning {{warning: 'DEPRECATED' is deprecated}}
+ at end
+
+
More information about the cfe-commits
mailing list