r195963 - Using a custom subject to reenable the Subjects line for the ns_bridged attribute. No functional change intended.

Aaron Ballman aaron at aaronballman.com
Fri Nov 29 08:13:13 PST 2013


Author: aaronballman
Date: Fri Nov 29 10:13:12 2013
New Revision: 195963

URL: http://llvm.org/viewvc/llvm-project?rev=195963&view=rev
Log:
Using a custom subject to reenable the Subjects line for the ns_bridged attribute. No functional change intended.

Modified:
    cfe/trunk/include/clang/Basic/Attr.td
    cfe/trunk/lib/Sema/SemaDeclAttr.cpp

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=195963&r1=195962&r2=195963&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Nov 29 10:13:12 2013
@@ -40,6 +40,9 @@ def NonBitField : SubsetSubject<Field,
 def ObjCInstanceMethod : SubsetSubject<ObjCMethod,
                                        [{S->isInstanceMethod()}]>;
 
+def Struct : SubsetSubject<Record,
+                           [{!S->isUnion()}]>;
+
 // A single argument to an attribute
 class Argument<string name, bit optional> {
   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>];
 }
 

Modified: cfe/trunk/lib/Sema/SemaDeclAttr.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclAttr.cpp?rev=195963&r1=195962&r2=195963&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclAttr.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclAttr.cpp Fri Nov 29 10:13:12 2013
@@ -3823,12 +3823,6 @@ static void handleCFTransferAttr(Sema &S
 
 static void handleNSBridgedAttr(Sema &S, Scope *Sc, Decl *D,
                                 const AttributeList &Attr) {
-  RecordDecl *RD = dyn_cast<RecordDecl>(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.





More information about the cfe-commits mailing list