|
@@ -4139,6 +4139,19 @@ static void handleRequiresCapabilityAttr(Sema &S, Decl *D,
|
|
D->addAttr(RCA);
|
|
D->addAttr(RCA);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static void handleDeprecatedAttr(Sema &S, Decl *D, const AttributeList &Attr) {
|
|
|
|
+ if (auto *NSD = dyn_cast<NamespaceDecl>(D)) {
|
|
|
|
+ if (NSD->isAnonymousNamespace()) {
|
|
|
|
+ S.Diag(Attr.getLoc(), diag::warn_deprecated_anonymous_namespace);
|
|
|
|
+ // Do not want to attach the attribute to the namespace because that will
|
|
|
|
+ // cause confusing diagnostic reports for uses of declarations within the
|
|
|
|
+ // namespace.
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ handleAttrWithMessage<DeprecatedAttr>(S, D, Attr);
|
|
|
|
+}
|
|
|
|
+
|
|
/// Handles semantic checking for features that are common to all attributes,
|
|
/// Handles semantic checking for features that are common to all attributes,
|
|
/// such as checking whether a parameter was properly specified, or the correct
|
|
/// such as checking whether a parameter was properly specified, or the correct
|
|
/// number of arguments were passed, etc.
|
|
/// number of arguments were passed, etc.
|
|
@@ -4283,7 +4296,7 @@ static void ProcessDeclAttribute(Sema &S, Scope *scope, Decl *D,
|
|
handleSimpleAttribute<CXX11NoReturnAttr>(S, D, Attr);
|
|
handleSimpleAttribute<CXX11NoReturnAttr>(S, D, Attr);
|
|
break;
|
|
break;
|
|
case AttributeList::AT_Deprecated:
|
|
case AttributeList::AT_Deprecated:
|
|
- handleAttrWithMessage<DeprecatedAttr>(S, D, Attr);
|
|
|
|
|
|
+ handleDeprecatedAttr(S, D, Attr);
|
|
break;
|
|
break;
|
|
case AttributeList::AT_Destructor:
|
|
case AttributeList::AT_Destructor:
|
|
handleDestructorAttr(S, D, Attr);
|
|
handleDestructorAttr(S, D, Attr);
|
|
@@ -4994,19 +5007,18 @@ static void DoEmitAvailabilityWarning(Sema &S, DelayedDiagnostic::DDKind K,
|
|
llvm_unreachable("Neither a deprecation or unavailable kind");
|
|
llvm_unreachable("Neither a deprecation or unavailable kind");
|
|
}
|
|
}
|
|
|
|
|
|
- DeclarationName Name = D->getDeclName();
|
|
|
|
if (!Message.empty()) {
|
|
if (!Message.empty()) {
|
|
- S.Diag(Loc, diag_message) << Name << Message;
|
|
|
|
|
|
+ S.Diag(Loc, diag_message) << D << Message;
|
|
if (ObjCProperty)
|
|
if (ObjCProperty)
|
|
S.Diag(ObjCProperty->getLocation(), diag::note_property_attribute)
|
|
S.Diag(ObjCProperty->getLocation(), diag::note_property_attribute)
|
|
<< ObjCProperty->getDeclName() << property_note_select;
|
|
<< ObjCProperty->getDeclName() << property_note_select;
|
|
} else if (!UnknownObjCClass) {
|
|
} else if (!UnknownObjCClass) {
|
|
- S.Diag(Loc, diag) << Name;
|
|
|
|
|
|
+ S.Diag(Loc, diag) << D;
|
|
if (ObjCProperty)
|
|
if (ObjCProperty)
|
|
S.Diag(ObjCProperty->getLocation(), diag::note_property_attribute)
|
|
S.Diag(ObjCProperty->getLocation(), diag::note_property_attribute)
|
|
<< ObjCProperty->getDeclName() << property_note_select;
|
|
<< ObjCProperty->getDeclName() << property_note_select;
|
|
} else {
|
|
} else {
|
|
- S.Diag(Loc, diag_fwdclass_message) << Name;
|
|
|
|
|
|
+ S.Diag(Loc, diag_fwdclass_message) << D;
|
|
S.Diag(UnknownObjCClass->getLocation(), diag::note_forward_class);
|
|
S.Diag(UnknownObjCClass->getLocation(), diag::note_forward_class);
|
|
}
|
|
}
|
|
|
|
|