aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2012-02-10 02:45:47 +0000
committerTed Kremenek <kremenek@apple.com>2012-02-10 02:45:47 +0000
commitd6cf912e1e33167452f328d15b98a790c58c03c0 (patch)
tree3fd3a053b9530dc87549b944b427fe39e8a8255e
parent572ae0a32ece4bd7ea24e3d8f9bfe3e11aa26414 (diff)
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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@150223 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Sema/Sema.h3
-rw-r--r--lib/Sema/SemaExpr.cpp17
-rw-r--r--lib/Sema/SemaExprObjC.cpp3
-rw-r--r--test/ARCMT/checking.m19
-rw-r--r--test/SemaObjC/attr-deprecated.m19
5 files changed, 16 insertions, 45 deletions
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index cfa8e1be94..14a5f70e7b 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -2251,9 +2251,6 @@ public:
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,
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index de70ad4cba..ae5dc55825 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -65,8 +65,7 @@ bool Sema::CanUseDecl(NamedDecl *D) {
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 @@ Sema::DiagnoseAvailabilityOfDecl(
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 @@ bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc,
return true;
}
}
- DiagnoseAvailabilityOfDecl(D, Loc, UnknownObjCClass);
+ DiagnoseAvailabilityOfDecl(*this, D, Loc, UnknownObjCClass);
// Warn if this is used but marked unused.
if (D->hasAttr<UnusedAttr>())
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 9b33b1e5f1..497b2ec5f5 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -1279,9 +1279,6 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
Method = LookupFactoryMethodInGlobalPool(Sel,
SourceRange(LBracLoc, RBracLoc),
receiverIsId);
- if (Method)
- DiagnoseAvailabilityOfDecl(Method, Loc, 0);
-
} else if (ReceiverType->isObjCClassType() ||
ReceiverType->isObjCQualifiedClassType()) {
// Handle messages to Class.
diff --git a/test/ARCMT/checking.m b/test/ARCMT/checking.m
index 0682fd1dde..cf7161187f 100644
--- a/test/ARCMT/checking.m
+++ b/test/ARCMT/checking.m
@@ -15,9 +15,9 @@ typedef int BOOL;
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 @@ id global_foo;
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 @@ void rdar9491791(int p) {
// 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
diff --git a/test/SemaObjC/attr-deprecated.m b/test/SemaObjC/attr-deprecated.m
index 42bffa8811..619203a87f 100644
--- a/test/SemaObjC/attr-deprecated.m
+++ b/test/SemaObjC/attr-deprecated.m
@@ -53,7 +53,7 @@ void t1(A *a)
void t2(id a)
{
- [a f]; // expected-warning {{'f' is deprecated}}
+ [a f];
}
void t3(A<P>* a)
@@ -121,20 +121,3 @@ void test(Test2 *foo) {
__attribute__((deprecated))
@interface A(Blah) // expected-error{{attributes may not be specified on a category}}
@end
-
-// rdar://10459930
-
-@class NSString;
-@interface NSDocumentController
-{
- id iv;
-}
-- (void)fileExtensionsFromType:(NSString *)typeName __attribute__((deprecated));
-@end
-
-@implementation NSDocumentController
-- (void) Meth {
- [iv fileExtensionsFromType:@"public.text"]; // expected-warning {{'fileExtensionsFromType:' is deprecated}}
-}
-- (void)fileExtensionsFromType:(NSString *)typeName {}
-@end