Objective-C. Attributes on class declarations carry over
to forward class declarations for diagnosis.
// rdar://16681279
llvm-svn: 211195
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 0e1aade..4b4cb6c 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -87,6 +87,12 @@
bool ObjCPropertyAccess) {
// See if this declaration is unavailable or deprecated.
std::string Message;
+
+ // Forward class declarations get their attributes from their definition.
+ if (ObjCInterfaceDecl *IDecl = dyn_cast<ObjCInterfaceDecl>(D)) {
+ if (IDecl->getDefinition())
+ D = IDecl->getDefinition();
+ }
AvailabilityResult Result = D->getAvailability(&Message);
if (const EnumConstantDecl *ECD = dyn_cast<EnumConstantDecl>(D))
if (Result == AR_Available) {