aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/clang/Sema/Sema.h5
-rw-r--r--lib/Sema/SemaDeclAttr.cpp6
-rw-r--r--lib/Sema/SemaExpr.cpp2
-rw-r--r--lib/Sema/SemaExprObjC.cpp5
-rw-r--r--test/SemaObjC/special-dep-unavail-warning.m2
5 files changed, 12 insertions, 8 deletions
diff --git a/include/clang/Sema/Sema.h b/include/clang/Sema/Sema.h
index 21e5d945c9..940d213e57 100644
--- a/include/clang/Sema/Sema.h
+++ b/include/clang/Sema/Sema.h
@@ -1923,7 +1923,8 @@ public:
}
void EmitDeprecationWarning(NamedDecl *D, llvm::StringRef Message,
- SourceLocation Loc, bool UnknownObjCClass=false);
+ SourceLocation Loc,
+ const ObjCInterfaceDecl *UnknownObjCClass=0);
void HandleDelayedDeprecationCheck(sema::DelayedDiagnostic &DD, Decl *Ctx);
@@ -1931,7 +1932,7 @@ public:
// Expression Parsing Callbacks: SemaExpr.cpp.
bool DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc,
- bool UnknownObjCClass=false);
+ const ObjCInterfaceDecl *UnknownObjCClass=0);
std::string getDeletedOrUnavailableSuffix(const FunctionDecl *FD);
bool DiagnosePropertyAccessorMismatch(ObjCPropertyDecl *PD,
ObjCMethodDecl *Getter,
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp
index 244f70a2db..746c5dbb37 100644
--- a/lib/Sema/SemaDeclAttr.cpp
+++ b/lib/Sema/SemaDeclAttr.cpp
@@ -3175,7 +3175,7 @@ void Sema::HandleDelayedDeprecationCheck(DelayedDiagnostic &DD,
void Sema::EmitDeprecationWarning(NamedDecl *D, llvm::StringRef Message,
SourceLocation Loc,
- bool UnknownObjCClass) {
+ const ObjCInterfaceDecl *UnknownObjCClass) {
// Delay if we're currently parsing a declaration.
if (DelayedDiagnostics.shouldDelayDiagnostics()) {
DelayedDiagnostics.add(DelayedDiagnostic::makeDeprecation(Loc, D, Message));
@@ -3191,7 +3191,9 @@ void Sema::EmitDeprecationWarning(NamedDecl *D, llvm::StringRef Message,
else {
if (!UnknownObjCClass)
Diag(Loc, diag::warn_deprecated) << D->getDeclName();
- else
+ else {
Diag(Loc, diag::warn_deprecated_fwdclass_message) << D->getDeclName();
+ Diag(UnknownObjCClass->getLocation(), diag::note_forward_class);
+ }
}
}
diff --git a/lib/Sema/SemaExpr.cpp b/lib/Sema/SemaExpr.cpp
index a773c3a817..da7619d0f4 100644
--- a/lib/Sema/SemaExpr.cpp
+++ b/lib/Sema/SemaExpr.cpp
@@ -56,7 +56,7 @@ using namespace sema;
/// referenced), false otherwise.
///
bool Sema::DiagnoseUseOfDecl(NamedDecl *D, SourceLocation Loc,
- bool UnknownObjCClass) {
+ const ObjCInterfaceDecl *UnknownObjCClass) {
if (getLangOptions().CPlusPlus && isa<FunctionDecl>(D)) {
// If there were any diagnostics suppressed by template argument deduction,
// emit them now.
diff --git a/lib/Sema/SemaExprObjC.cpp b/lib/Sema/SemaExprObjC.cpp
index 04f5e32bda..2a262f0939 100644
--- a/lib/Sema/SemaExprObjC.cpp
+++ b/lib/Sema/SemaExprObjC.cpp
@@ -1155,7 +1155,7 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
// Search protocol qualifiers.
Method = LookupMethodInQualifiedType(Sel, OCIType, true);
- bool forwardClass = false;
+ const ObjCInterfaceDecl *forwardClass = 0;
if (!Method) {
// If we have implementations in scope, check "private" methods.
Method = LookupPrivateInstanceMethod(Sel, ClassDecl);
@@ -1167,7 +1167,8 @@ ExprResult Sema::BuildInstanceMessage(Expr *Receiver,
if (OCIType->qual_empty()) {
Method = LookupInstanceMethodInGlobalPool(Sel,
SourceRange(LBracLoc, RBracLoc));
- forwardClass = OCIType->getInterfaceDecl()->isForwardDecl();
+ if (OCIType->getInterfaceDecl()->isForwardDecl())
+ forwardClass = OCIType->getInterfaceDecl();
if (Method && !forwardClass)
Diag(Loc, diag::warn_maynot_respond)
<< OCIType->getInterfaceDecl()->getIdentifier() << Sel;
diff --git a/test/SemaObjC/special-dep-unavail-warning.m b/test/SemaObjC/special-dep-unavail-warning.m
index 8e03e1c4c2..1d07a49e61 100644
--- a/test/SemaObjC/special-dep-unavail-warning.m
+++ b/test/SemaObjC/special-dep-unavail-warning.m
@@ -27,7 +27,7 @@
@end
-@class C;
+@class C; // expected-note 5 {{forward class is declared here}}
void test(C *c) {
[c depInA]; // expected-warning {{'depInA' maybe deprecated because receiver type is unknown}}