diff options
Diffstat (limited to 'lib/Sema/SemaDeclAttr.cpp')
| -rw-r--r-- | lib/Sema/SemaDeclAttr.cpp | 28 | 
1 files changed, 11 insertions, 17 deletions
diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index a1ba9de368dbf..027b3fe0e7828 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -2398,10 +2398,8 @@ static void handleAvailabilityAttr(Sema &S, Decl *D,        << Platform->Ident;    NamedDecl *ND = dyn_cast<NamedDecl>(D); -  if (!ND) { -    S.Diag(Attr.getLoc(), diag::warn_attribute_ignored) << Attr.getName(); +  if (!ND) // We warned about this already, so just return.      return; -  }    AvailabilityChange Introduced = Attr.getAvailabilityIntroduced();    AvailabilityChange Deprecated = Attr.getAvailabilityDeprecated(); @@ -2511,12 +2509,6 @@ static void handleExternalSourceSymbolAttr(Sema &S, Decl *D,    assert(checkAttributeAtMostNumArgs(S, Attr, 3) &&           "Invalid number of arguments in an external_source_symbol attribute"); -  if (!isa<NamedDecl>(D)) { -    S.Diag(Attr.getLoc(), diag::warn_attribute_wrong_decl_type) -        << Attr.getName() << ExpectedNamedDecl; -    return; -  } -    StringRef Language;    if (const auto *SE = dyn_cast_or_null<StringLiteral>(Attr.getArgAsExpr(0)))      Language = SE->getString(); @@ -5765,18 +5757,21 @@ static void handleOpenCLNoSVMAttr(Sema &S, Decl *D, const AttributeList &Attr) {  static bool handleCommonAttributeFeatures(Sema &S, Scope *scope, Decl *D,                                            const AttributeList &Attr) {    // Several attributes carry different semantics than the parsing requires, so -  // those are opted out of the common handling. +  // those are opted out of the common argument checks.    //    // We also bail on unknown and ignored attributes because those are handled    // as part of the target-specific handling logic. -  if (Attr.hasCustomParsing() || -      Attr.getKind() == AttributeList::UnknownAttribute) +  if (Attr.getKind() == AttributeList::UnknownAttribute)      return false; -    // Check whether the attribute requires specific language extensions to be    // enabled.    if (!Attr.diagnoseLangOpts(S))      return true; +  // Check whether the attribute appertains to the given subject. +  if (!Attr.diagnoseAppertainsTo(S, D)) +    return true; +  if (Attr.hasCustomParsing()) +    return false;    if (Attr.getMinArgs() == Attr.getMaxArgs()) {      // If there are no optional arguments, then checking for the argument count @@ -5793,10 +5788,6 @@ static bool handleCommonAttributeFeatures(Sema &S, Scope *scope, Decl *D,        return true;    } -  // Check whether the attribute appertains to the given subject. -  if (!Attr.diagnoseAppertainsTo(S, D)) -    return true; -    return false;  } @@ -6676,6 +6667,9 @@ void Sema::ProcessDeclAttributes(Scope *S, Decl *D, const Declarator &PD) {    // Finally, apply any attributes on the decl itself.    if (const AttributeList *Attrs = PD.getAttributes())      ProcessDeclAttributeList(S, D, Attrs); + +  // Apply additional attributes specified by '#pragma clang attribute'. +  AddPragmaAttributes(S, D);  }  /// Is the given declaration allowed to use a forbidden type?  | 
