r195508 - Updating Subjects definitions for attributes based on semantic handling. Removes Subjects for things we cannot currently check, adds Subjects for things we can, and rectifies most discrepancies. Since Subjects are not currently handled in tablegen, there are no functional changes with this patch.

Aaron Ballman aaron at aaronballman.com
Fri Nov 22 14:49:32 PST 2013


Author: aaronballman
Date: Fri Nov 22 16:49:31 2013
New Revision: 195508

URL: http://llvm.org/viewvc/llvm-project?rev=195508&view=rev
Log:
Updating Subjects definitions for attributes based on semantic handling. Removes Subjects for things we cannot currently check, adds Subjects for things we can, and rectifies most discrepancies. Since Subjects are not currently handled in tablegen, there are no functional changes with this patch.

Modified:
    cfe/trunk/include/clang/Basic/Attr.td

Modified: cfe/trunk/include/clang/Basic/Attr.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Attr.td?rev=195508&r1=195507&r2=195508&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Attr.td (original)
+++ cfe/trunk/include/clang/Basic/Attr.td Fri Nov 22 16:49:31 2013
@@ -202,6 +202,7 @@ def AllocSize : InheritableAttr {
 
 def AlwaysInline : InheritableAttr {
   let Spellings = [GNU<"always_inline">, CXX11<"gnu", "always_inline">];
+  let Subjects = [Function];
 }
 
 def TLSModel : InheritableAttr {
@@ -246,6 +247,7 @@ def Availability : InheritableAttr {
              .Default(llvm::StringRef());
 } }];
   let HasCustomParsing = 1;
+  let Subjects = [Named];
 }
 
 def Blocks : InheritableAttr {
@@ -304,14 +306,17 @@ def CFConsumed : InheritableParamAttr {
 def Cleanup : InheritableAttr {
   let Spellings = [GNU<"cleanup">, CXX11<"gnu", "cleanup">];
   let Args = [FunctionArgument<"FunctionDecl">];
+  let Subjects = [Var];
 }
 
 def Cold : InheritableAttr {
   let Spellings = [GNU<"cold">, CXX11<"gnu", "cold">];
+  let Subjects = [Function];
 }
 
 def Common : InheritableAttr {
   let Spellings = [GNU<"common">, CXX11<"gnu", "common">];
+  let Subjects = [Var];
 }
 
 def Const : InheritableAttr {
@@ -322,22 +327,27 @@ def Const : InheritableAttr {
 def Constructor : InheritableAttr {
   let Spellings = [GNU<"constructor">, CXX11<"gnu", "constructor">];
   let Args = [DefaultIntArgument<"Priority", 65535>];
+  let Subjects = [Function];
 }
 
 def CUDAConstant : InheritableAttr {
   let Spellings = [GNU<"constant">];
+  let Subjects = [Var];
 }
 
 def CUDADevice : InheritableAttr {
   let Spellings = [GNU<"device">];
+  let Subjects = [Function, Var];
 }
 
 def CUDAGlobal : InheritableAttr {
   let Spellings = [GNU<"global">];
+  let Subjects = [Function];
 }
 
 def CUDAHost : InheritableAttr {
   let Spellings = [GNU<"host">];
+  let Subjects = [Function];
 }
 
 def CUDALaunchBounds : InheritableAttr {
@@ -347,6 +357,7 @@ def CUDALaunchBounds : InheritableAttr {
 
 def CUDAShared : InheritableAttr {
   let Spellings = [GNU<"shared">];
+  let Subjects = [Var];
 }
 
 def C11NoReturn : InheritableAttr {
@@ -378,10 +389,12 @@ def Deprecated : InheritableAttr {
 def Destructor : InheritableAttr {
   let Spellings = [GNU<"destructor">, CXX11<"gnu", "destructor">];
   let Args = [DefaultIntArgument<"Priority", 65535>];
+  let Subjects = [Function];
 }
 
 def ExtVectorType : Attr {
   let Spellings = [GNU<"ext_vector_type">];
+  let Subjects = [TypedefName];
   let Args = [ExprArgument<"NumElements">];
   let ASTNode = 0;
 }
@@ -405,7 +418,7 @@ def Final : InheritableAttr {
 
 def MinSize : InheritableAttr {
   let Spellings = [GNU<"minsize">];
-  let Subjects = [Function];
+  let Subjects = [Function, ObjCMethod];
 }
 
 def Format : InheritableAttr {
@@ -421,27 +434,33 @@ def FormatArg : InheritableAttr {
 
 def GNUInline : InheritableAttr {
   let Spellings = [GNU<"gnu_inline">, CXX11<"gnu", "gnu_inline">];
+  let Subjects = [Function];
 }
 
 def Hot : InheritableAttr {
   let Spellings = [GNU<"hot">, CXX11<"gnu", "hot">];
+  let Subjects = [Function];
 }
 
 def IBAction : InheritableAttr {
   let Spellings = [GNU<"ibaction">];
+  let Subjects = [ObjCMethod];
 }
 
 def IBOutlet : InheritableAttr {
   let Spellings = [GNU<"iboutlet">];
+  let Subjects = [ObjCIvar, ObjCProperty];
 }
 
 def IBOutletCollection : InheritableAttr {
   let Spellings = [GNU<"iboutletcollection">];
   let Args = [TypeArgument<"Interface", 1>];
+  let Subjects = [ObjCIvar, ObjCProperty];
 }
 
 def Malloc : InheritableAttr {
   let Spellings = [GNU<"malloc">, CXX11<"gnu", "malloc">];
+  let Subjects = [Function];
 }
 
 def MaxFieldAlignment : InheritableAttr {
@@ -477,6 +496,7 @@ def Mode : Attr {
 
 def Naked : InheritableAttr {
   let Spellings = [GNU<"naked">, CXX11<"gnu", "naked">];
+  let Subjects = [Function];
 }
 
 def NeonPolyVectorType : TypeAttr {
@@ -491,10 +511,12 @@ def NeonVectorType : TypeAttr {
 
 def ReturnsTwice : InheritableAttr {
   let Spellings = [GNU<"returns_twice">, CXX11<"gnu", "returns_twice">];
+  let Subjects = [Function];
 }
 
 def NoCommon : InheritableAttr {
   let Spellings = [GNU<"nocommon">, CXX11<"gnu", "nocommon">];
+  let Subjects = [Var];
 }
 
 def NoDebug : InheritableAttr {
@@ -503,6 +525,7 @@ def NoDebug : InheritableAttr {
 
 def NoInline : InheritableAttr {
   let Spellings = [GNU<"noinline">, CXX11<"gnu", "noinline">];
+  let Subjects = [Function];
 }
 
 def NoMips16 : InheritableAttr, TargetSpecificAttr {
@@ -526,7 +549,6 @@ def NonNull : InheritableAttr {
 def NoReturn : InheritableAttr {
   let Spellings = [GNU<"noreturn">, CXX11<"gnu", "noreturn">];
   // FIXME: Does GCC allow this on the function instead?
-  let Subjects = [Function];
 }
 
 def NoInstrumentFunction : InheritableAttr {
@@ -584,6 +606,7 @@ def NSConsumed : InheritableParamAttr {
 
 def ObjCException : InheritableAttr {
   let Spellings = [GNU<"objc_exception">];
+  let Subjects = [ObjCInterface];
 }
 
 def ObjCMethodFamily : InheritableAttr {
@@ -621,6 +644,7 @@ def ObjCRootClass : InheritableAttr {
 
 def Overloadable : Attr {
   let Spellings = [GNU<"overloadable">];
+  let Subjects = [Function];
 }
 
 def Override : InheritableAttr { 
@@ -641,6 +665,7 @@ def Ownership : InheritableAttr {
 
 def Packed : InheritableAttr {
   let Spellings = [GNU<"packed">, CXX11<"gnu", "packed">];
+  let Subjects = [Tag, Field];
 }
 
 def PnaclCall : InheritableAttr {
@@ -686,6 +711,7 @@ def WorkGroupSizeHint :  InheritableAttr
 def InitPriority : InheritableAttr {
   let Spellings = [GNU<"init_priority">];
   let Args = [UnsignedArgument<"Priority">];
+  let Subjects = [Var];
 }
 
 def Section : InheritableAttr {
@@ -697,6 +723,7 @@ def Sentinel : InheritableAttr {
   let Spellings = [GNU<"sentinel">, CXX11<"gnu", "sentinel">];
   let Args = [DefaultIntArgument<"Sentinel", 0>,
               DefaultIntArgument<"NullPos", 0>];
+  let Subjects = [Function, ObjCMethod, Block, Var];
 }
 
 def StdCall : InheritableAttr {
@@ -723,6 +750,7 @@ def Pascal : InheritableAttr {
 
 def TransparentUnion : InheritableAttr {
   let Spellings = [GNU<"transparent_union">, CXX11<"gnu", "transparent_union">];
+  let Subjects = [Record, TypedefName];
 }
 
 def Unavailable : InheritableAttr {
@@ -789,6 +817,7 @@ def TypeVisibility : InheritableAttr {
   let Args = [EnumArgument<"Visibility", "VisibilityType",
                            ["default", "hidden", "internal", "protected"],
                            ["Default", "Hidden", "Hidden", "Protected"]>];
+  let Subjects = [Tag, ObjCInterface, Namespace];
 }
 
 def VecReturn : InheritableAttr {
@@ -809,6 +838,7 @@ def WarnUnusedResult : InheritableAttr {
 
 def Weak : InheritableAttr {
   let Spellings = [GNU<"weak">, CXX11<"gnu", "weak">];
+  let Subjects = [Var, Function, CXXRecord];
 }
 
 def WeakImport : InheritableAttr {
@@ -819,6 +849,7 @@ def WeakRef : InheritableAttr {
   let Spellings = [GNU<"weakref">, CXX11<"gnu", "weakref">];
   // A WeakRef that has an argument is treated as being an AliasAttr
   let Args = [StringArgument<"Aliasee", 1>];
+  let Subjects = [Var, Function];
 }
 
 def X86ForceAlignArgPointer : InheritableAttr, TargetSpecificAttr {
@@ -831,16 +862,19 @@ def NoSanitizeAddress : InheritableAttr
                    GNU<"no_sanitize_address">,
                    CXX11<"gnu", "no_address_safety_analysis">,
                    CXX11<"gnu", "no_sanitize_address">];
+  let Subjects = [Function, FunctionTemplate];
 }
 
 // Attribute to disable ThreadSanitizer checks.
 def NoSanitizeThread : InheritableAttr {
   let Spellings = [GNU<"no_sanitize_thread">];
+  let Subjects = [Function, FunctionTemplate];
 }
 
 // Attribute to disable MemorySanitizer checks.
 def NoSanitizeMemory : InheritableAttr {
   let Spellings = [GNU<"no_sanitize_memory">];
+  let Subjects = [Function, FunctionTemplate];
 }
 
 // C/C++ Thread safety attributes (e.g. for deadlock, data race checking)
@@ -1053,7 +1087,6 @@ def ArgumentWithTypeTag : InheritableAtt
               UnsignedArgument<"ArgumentIdx">,
               UnsignedArgument<"TypeTagIdx">,
               BoolArgument<"IsPointer">];
-  let Subjects = [Function];
   let HasCustomParsing = 1;
 }
 





More information about the cfe-commits mailing list