[cfe-commits] r150223 - in /cfe/trunk: include/clang/Sema/Sema.h lib/Sema/SemaExpr.cpp lib/Sema/SemaExprObjC.cpp test/ARCMT/checking.m test/SemaObjC/attr-deprecated.m
Ted Kremenek
kremenek at apple.com
Thu Feb 9 18:45:47 PST 2012
Author: kremenek
Date: Thu Feb 9 20:45:47 2012
New Revision: 150223
URL: http://llvm.org/viewvc/llvm-project?rev=150223&view=rev
Log:
Revert r145999. This turned out to be a bad idea. Unfortunately, 'id' is used so profusely
in many APIs and large codebases that this made the deprecated warning trigger happy to
the point of not being useful.
Modified:
cfe/trunk/include/clang/Sema/Sema.h
cfe/trunk/lib/Sema/SemaExpr.cpp
cfe/trunk/lib/Sema/SemaExprObjC.cpp
cfe/trunk/test/ARCMT/checking.m
cfe/trunk/test/SemaObjC/attr-deprecated.m
Modified: cfe/trunk/include/clang/Sema/Sema.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Sema/Sema.h?rev=150223&r1=150222&r2=150223&view=diff
==============================================================================
--- cfe/trunk/include/clang/Sema/Sema.h (original)
+++ cfe/trunk/include/clang/Sema/Sema.h Thu Feb 9 20:45:47 2012
@@ -2251,9 +2251,6 @@
bool CanUseDecl(NamedDecl *D);
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc,
const ObjCInterfaceDecl *UnknownObjCClass=0);
- AvailabilityResult DiagnoseAvailabilityOfDecl(NamedDecl *D,
- SourceLocation Loc,
- const ObjCInterfaceDecl *UnknownObjCClass);
std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD);
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD,
ObjCMethodDecl *Getter,
Modified: cfe/trunk/lib/Sema/SemaExpr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExpr.cpp?rev=150223&r1=150222&r2=150223&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExpr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExpr.cpp Thu Feb 9 20:45:47 2012
@@ -65,8 +65,7 @@
return true;
}
-AvailabilityResult
-Sema::DiagnoseAvailabilityOfDecl(
+static AvailabilityResult DiagnoseAvailabilityOfDecl(Sema &S,
NamedDecl *D, SourceLocation Loc,
const ObjCInterfaceDecl *UnknownObjCClass) {
// See if this declaration is unavailable or deprecated.
@@ -85,22 +84,22 @@
break;
case AR_Deprecated:
- EmitDeprecationWarning(D, Message, Loc, UnknownObjCClass);
+ S.EmitDeprecationWarning(D, Message, Loc, UnknownObjCClass);
break;
case AR_Unavailable:
- if (getCurContextAvailability() != AR_Unavailable) {
+ if (S.getCurContextAvailability() != AR_Unavailable) {
if (Message.empty()) {
if (!UnknownObjCClass)
- Diag(Loc, diag::err_unavailable) << D->getDeclName();
+ S.Diag(Loc, diag::err_unavailable) << D->getDeclName();
else
- Diag(Loc, diag::warn_unavailable_fwdclass_message)
+ S.Diag(Loc, diag::warn_unavailable_fwdclass_message)
<< D->getDeclName();
}
else
- Diag(Loc, diag::err_unavailable_message)
+ S.Diag(Loc, diag::err_unavailable_message)
<< D->getDeclName() << Message;
- Diag(D->getLocation(), diag::note_unavailable_here)
+ S.Diag(D->getLocation(), diag::note_unavailable_here)
<< isa<FunctionDecl>(D) << false;
}
break;
@@ -155,7 +154,7 @@
return true;
}
}
- DiagnoseAvailabilityOfDecl(D, Loc, UnknownObjCClass);
+ DiagnoseAvailabilityOfDecl(*this, D, Loc, UnknownObjCClass);
// Warn if this is used but marked unused.
if (D->hasAttr<UnusedAttr>())
Modified: cfe/trunk/lib/Sema/SemaExprObjC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprObjC.cpp?rev=150223&r1=150222&r2=150223&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprObjC.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprObjC.cpp Thu Feb 9 20:45:47 2012
@@ -1279,9 +1279,6 @@
Method = LookupFactoryMethodInGlobalPool(Sel,
SourceRange(LBracLoc, RBracLoc),
receiverIsId);
- if (Method)
- DiagnoseAvailabilityOfDecl(Method, Loc, 0);
-
} else if (ReceiverType->isObjCClassType() ||
ReceiverType->isObjCQualifiedClassType()) {
// Handle messages to Class.
Modified: cfe/trunk/test/ARCMT/checking.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/ARCMT/checking.m?rev=150223&r1=150222&r2=150223&view=diff
==============================================================================
--- cfe/trunk/test/ARCMT/checking.m (original)
+++ cfe/trunk/test/ARCMT/checking.m Thu Feb 9 20:45:47 2012
@@ -15,9 +15,9 @@
typedef unsigned NSUInteger;
@protocol NSObject
-- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note {{unavailable here}}
+- (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
- (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
-- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; // expected-note 4 {{unavailable here}}
+- (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
- (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE;
@end
@@ -75,20 +75,16 @@
void test1(A *a, BOOL b, struct UnsafeS *unsafeS) {
[[a delegate] release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \
- // expected-error {{ARC forbids explicit message send}} \
- // expected-error {{unavailable}}
+ // expected-error {{ARC forbids explicit message send}}
[a.delegate release]; // expected-error {{it is not safe to remove 'retain' message on the result of a 'delegate' message; the object that was passed to 'setDelegate:' may not be properly retained}} \
- // expected-error {{ARC forbids explicit message send}} \
- // expected-error {{unavailable}}
+ // expected-error {{ARC forbids explicit message send}}
[unsafeS->unsafeObj retain]; // expected-error {{it is not safe to remove 'retain' message on an __unsafe_unretained type}} \
// expected-error {{ARC forbids explicit message send}}
id foo = [unsafeS->unsafeObj retain]; // no warning.
[global_foo retain]; // expected-error {{it is not safe to remove 'retain' message on a global variable}} \
- // expected-error {{ARC forbids explicit message send}} \
- // expected-error {{unavailable}}
+ // expected-error {{ARC forbids explicit message send}}
[global_foo release]; // expected-error {{it is not safe to remove 'release' message on a global variable}} \
- // expected-error {{ARC forbids explicit message send}} \
- // expected-error {{unavailable}}
+ // expected-error {{ARC forbids explicit message send}}
[a dealloc];
[a retain];
[a retainCount]; // expected-error {{ARC forbids explicit message send of 'retainCount'}}
@@ -302,8 +298,7 @@
// rdar://9504750
void rdar9504750(id p) {
- RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}} \
- // expected-error {{unavailable}}
+ RELEASE_MACRO(p); // expected-error {{ARC forbids explicit message send of 'release'}}
}
// rdar://8939557
Modified: cfe/trunk/test/SemaObjC/attr-deprecated.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/attr-deprecated.m?rev=150223&r1=150222&r2=150223&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/attr-deprecated.m (original)
+++ cfe/trunk/test/SemaObjC/attr-deprecated.m Thu Feb 9 20:45:47 2012
@@ -53,7 +53,7 @@
void t2(id a)
{
- [a f]; // expected-warning {{'f' is deprecated}}
+ [a f];
}
void t3(A<P>* a)
@@ -121,20 +121,3 @@
__attribute__((deprecated))
@interface A(Blah) // expected-error{{attributes may not be specified on a category}}
@end
-
-// rdar://10459930
-
- at class NSString;
- at interface NSDocumentController
-{
- id iv;
-}
-- (void)fileExtensionsFromType:(NSString *)typeName __attribute__((deprecated));
- at end
-
- at implementation NSDocumentController
-- (void) Meth {
- [iv fileExtensionsFromType:@"public.text"]; // expected-warning {{'fileExtensionsFromType:' is deprecated}}
-}
-- (void)fileExtensionsFromType:(NSString *)typeName {}
- at end
More information about the cfe-commits
mailing list