From 3e794b381336a696fd5bb82ab9cdc65ce1446c8a Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 29 Nov 2013 16:13:12 +0000 Subject: [PATCH] Using a custom subject to reenable the Subjects line for the ns_bridged attribute. No functional change intended. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@195963 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/Basic/Attr.td | 5 ++++- lib/Sema/SemaDeclAttr.cpp | 6 ------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/clang/Basic/Attr.td b/include/clang/Basic/Attr.td index 307c8b181a..4ca6a97709 100644 --- a/include/clang/Basic/Attr.td +++ b/include/clang/Basic/Attr.td @@ -40,6 +40,9 @@ def NonBitField : SubsetSubjectisInstanceMethod()}]>; +def Struct : SubsetSubjectisUnion()}]>; + // A single argument to an attribute class Argument { string Name = name; @@ -574,7 +577,7 @@ def NoThrow : InheritableAttr { def NSBridged : InheritableAttr { let Spellings = [GNU<"ns_bridged">]; -// let Subjects = SubjectList<[Record], ErrorDiag>; + let Subjects = SubjectList<[Struct], ErrorDiag, "ExpectedStruct">; let Args = [IdentifierArgument<"BridgedType", 1>]; } diff --git a/lib/Sema/SemaDeclAttr.cpp b/lib/Sema/SemaDeclAttr.cpp index f49ea11faa..d4fb920463 100644 --- a/lib/Sema/SemaDeclAttr.cpp +++ b/lib/Sema/SemaDeclAttr.cpp @@ -3823,12 +3823,6 @@ static void handleCFTransferAttr(Sema &S, Decl *D, const AttributeList &A) { static void handleNSBridgedAttr(Sema &S, Scope *Sc, Decl *D, const AttributeList &Attr) { - RecordDecl *RD = dyn_cast(D); - if (!RD || RD->isUnion()) { - S.Diag(D->getLocStart(), diag::err_attribute_wrong_decl_type) - << Attr.getRange() << Attr.getName() << ExpectedStruct; - } - IdentifierLoc *Parm = Attr.isArgIdent(0) ? Attr.getArgAsIdent(0) : 0; // In Objective-C, verify that the type names an Objective-C type. -- 2.40.0