aboutsummaryrefslogtreecommitdiff
path: root/contrib/llvm-project/clang/include/clang/Basic/Attr.td
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/llvm-project/clang/include/clang/Basic/Attr.td')
-rw-r--r--contrib/llvm-project/clang/include/clang/Basic/Attr.td413
1 files changed, 172 insertions, 241 deletions
diff --git a/contrib/llvm-project/clang/include/clang/Basic/Attr.td b/contrib/llvm-project/clang/include/clang/Basic/Attr.td
index 763b5b993e9a..bc4a380545af 100644
--- a/contrib/llvm-project/clang/include/clang/Basic/Attr.td
+++ b/contrib/llvm-project/clang/include/clang/Basic/Attr.td
@@ -174,12 +174,31 @@ class IdentifierArgument<string name, bit opt = 0> : Argument<name, opt>;
class IntArgument<string name, bit opt = 0> : Argument<name, opt>;
class StringArgument<string name, bit opt = 0> : Argument<name, opt>;
class ExprArgument<string name, bit opt = 0> : Argument<name, opt>;
-class FunctionArgument<string name, bit opt = 0, bit fake = 0> : Argument<name,
- opt,
- fake>;
-class NamedArgument<string name, bit opt = 0, bit fake = 0> : Argument<name,
- opt,
- fake>;
+class DeclArgument<DeclNode kind, string name, bit opt = 0, bit fake = 0>
+ : Argument<name, opt, fake> {
+ DeclNode Kind = kind;
+}
+
+// An argument of a OMPDeclareVariantAttr that represents the `match`
+// clause of the declare variant by keeping the information (incl. nesting) in
+// an OMPTraitInfo object.
+//
+// With some exceptions, the `match(<context-selector>)` clause looks roughly
+// as follows:
+// context-selector := list<selector-set>
+// selector-set := <kind>={list<selector>}
+// selector := <kind>([score(<const-expr>):] list<trait>)
+// trait := <kind>
+//
+// The structure of an OMPTraitInfo object is a tree as defined below:
+//
+// OMPTraitInfo := {list<OMPTraitSet>}
+// OMPTraitSet := {Kind, list<OMPTraitSelector>}
+// OMPTraitSelector := {Kind, Expr, list<OMPTraitProperty>}
+// OMPTraitProperty := {Kind}
+//
+class OMPTraitInfoArgument<string name> : Argument<name, 0>;
+
class TypeArgument<string name, bit opt = 0> : Argument<name, opt>;
class UnsignedArgument<string name, bit opt = 0> : Argument<name, opt>;
class VariadicUnsignedArgument<string name> : Argument<name, 1>;
@@ -238,7 +257,6 @@ class VariadicEnumArgument<string name, string type, list<string> values,
class Spelling<string name, string variety> {
string Name = name;
string Variety = variety;
- bit KnownToGCC;
}
class GNU<string name> : Spelling<name, "GNU">;
@@ -258,11 +276,11 @@ class Pragma<string namespace, string name> : Spelling<name, "Pragma"> {
string Namespace = namespace;
}
-// The GCC spelling implies GNU<name> and CXX11<"gnu", name> and also sets
-// KnownToGCC to 1. This spelling should be used for any GCC-compatible
+// The GCC spelling implies GNU<name>, CXX11<"gnu", name>, and optionally,
+// C2x<"gnu", name>. This spelling should be used for any GCC-compatible
// attributes.
-class GCC<string name> : Spelling<name, "GCC"> {
- let KnownToGCC = 1;
+class GCC<string name, bit allowInC = 1> : Spelling<name, "GCC"> {
+ bit AllowInC = allowInC;
}
// The Clang spelling implies GNU<name>, CXX11<"clang", name>, and optionally,
@@ -291,6 +309,7 @@ class SubjectList<list<AttrSubject> subjects, SubjectDiag diag = WarnDiag,
}
class LangOpt<string name, code customCode = [{}]> {
+ // The language option to test; ignored when custom code is supplied.
string Name = name;
// A custom predicate, written as an expression evaluated in a context with
@@ -300,17 +319,16 @@ class LangOpt<string name, code customCode = [{}]> {
def MicrosoftExt : LangOpt<"MicrosoftExt">;
def Borland : LangOpt<"Borland">;
def CUDA : LangOpt<"CUDA">;
-def HIP : LangOpt<"HIP">;
def SYCL : LangOpt<"SYCLIsDevice">;
-def COnly : LangOpt<"COnly", "!LangOpts.CPlusPlus">;
+def COnly : LangOpt<"", "!LangOpts.CPlusPlus">;
def CPlusPlus : LangOpt<"CPlusPlus">;
def OpenCL : LangOpt<"OpenCL">;
def RenderScript : LangOpt<"RenderScript">;
def ObjC : LangOpt<"ObjC">;
def BlocksSupported : LangOpt<"Blocks">;
def ObjCAutoRefCount : LangOpt<"ObjCAutoRefCount">;
-def ObjCNonFragileRuntime : LangOpt<"ObjCNonFragileRuntime",
- "LangOpts.ObjCRuntime.allowsClassStubs()">;
+def ObjCNonFragileRuntime
+ : LangOpt<"", "LangOpts.ObjCRuntime.allowsClassStubs()">;
// Language option for CMSE extensions
def Cmse : LangOpt<"Cmse">;
@@ -337,6 +355,8 @@ class TargetArch<list<string> arches> : TargetSpec {
let Arches = arches;
}
def TargetARM : TargetArch<["arm", "thumb", "armeb", "thumbeb"]>;
+def TargetAArch64 : TargetArch<["aarch64"]>;
+def TargetAnyArm : TargetArch<!listconcat(TargetARM.Arches, TargetAArch64.Arches)>;
def TargetAVR : TargetArch<["avr"]>;
def TargetBPF : TargetArch<["bpfel", "bpfeb"]>;
def TargetMips32 : TargetArch<["mips", "mipsel"]>;
@@ -420,6 +440,7 @@ def SubjectMatcherForEnumConstant : AttrSubjectMatcherRule<"enum_constant",
def SubjectMatcherForVar : AttrSubjectMatcherRule<"variable", [Var], [
AttrSubjectMatcherSubRule<"is_thread_local", [TLSVar]>,
AttrSubjectMatcherSubRule<"is_global", [GlobalVar]>,
+ AttrSubjectMatcherSubRule<"is_local", [LocalVar]>,
AttrSubjectMatcherSubRule<"is_parameter", [ParmVar]>,
// unless(is_parameter)
AttrSubjectMatcherSubRule<"is_parameter", [NonParmVar], 1>
@@ -489,6 +510,8 @@ class Attr {
bit ASTNode = 1;
// Set to true for attributes which have handler in Sema.
bit SemaHandler = 1;
+ // Set to true if this attribute doesn't need custom handling in Sema.
+ bit SimpleHandler = 0;
// Set to true for attributes that are completely ignored.
bit Ignored = 0;
// Set to true if the attribute's parsing does not match its semantic
@@ -581,7 +604,7 @@ class IgnoredAttr : Attr {
//
def AbiTag : Attr {
- let Spellings = [GCC<"abi_tag">];
+ let Spellings = [GCC<"abi_tag", /*AllowInC*/0>];
let Args = [VariadicStringArgument<"Tags">];
let Subjects = SubjectList<[Struct, Var, Function, Namespace], ErrorDiag>;
let MeaningfulToClassTemplateDefinition = 1;
@@ -601,11 +624,11 @@ def Alias : Attr {
let Documentation = [Undocumented];
}
-def ArmMveAlias : InheritableAttr, TargetSpecificAttr<TargetARM> {
- let Spellings = [Clang<"__clang_arm_mve_alias">];
+def ArmBuiltinAlias : InheritableAttr, TargetSpecificAttr<TargetAnyArm> {
+ let Spellings = [Clang<"__clang_arm_builtin_alias">];
let Args = [IdentifierArgument<"BuiltinName">];
let Subjects = SubjectList<[Function], ErrorDiag>;
- let Documentation = [ArmMveAliasDocs];
+ let Documentation = [ArmBuiltinAliasDocs];
}
def Aligned : InheritableAttr {
@@ -655,8 +678,9 @@ def AlwaysInline : InheritableAttr {
def Artificial : InheritableAttr {
let Spellings = [GCC<"artificial">];
- let Subjects = SubjectList<[InlineFunction], WarnDiag>;
+ let Subjects = SubjectList<[InlineFunction]>;
let Documentation = [ArtificialDocs];
+ let SimpleHandler = 1;
}
def XRayInstrument : InheritableAttr {
@@ -668,6 +692,7 @@ def XRayInstrument : InheritableAttr {
Accessor<"neverXRayInstrument",
[Clang<"xray_never_instrument">]>];
let Documentation = [XRayDocs];
+ let SimpleHandler = 1;
}
def XRayLogArgs : InheritableAttr {
@@ -924,15 +949,29 @@ def OSConsumesThis : InheritableAttr {
let Spellings = [Clang<"os_consumes_this">];
let Subjects = SubjectList<[NonStaticCXXMethod]>;
let Documentation = [RetainBehaviorDocs];
+ let SimpleHandler = 1;
}
def Cleanup : InheritableAttr {
let Spellings = [GCC<"cleanup">];
- let Args = [FunctionArgument<"FunctionDecl">];
+ let Args = [DeclArgument<Function, "FunctionDecl">];
let Subjects = SubjectList<[LocalVar]>;
let Documentation = [Undocumented];
}
+def CmseNSEntry : InheritableAttr, TargetSpecificAttr<TargetARM> {
+ let Spellings = [GNU<"cmse_nonsecure_entry">];
+ let Subjects = SubjectList<[Function]>;
+ let LangOpts = [Cmse];
+ let Documentation = [ArmCmseNSEntryDocs];
+}
+
+def CmseNSCall : TypeAttr, TargetSpecificAttr<TargetARM> {
+ let Spellings = [GNU<"cmse_nonsecure_call">];
+ let LangOpts = [Cmse];
+ let Documentation = [ArmCmseNSCallDocs];
+}
+
def Cold : InheritableAttr {
let Spellings = [GCC<"cold">];
let Subjects = SubjectList<[Function]>;
@@ -948,6 +987,7 @@ def Common : InheritableAttr {
def Const : InheritableAttr {
let Spellings = [GCC<"const">, GCC<"__const">];
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def ConstInit : InheritableAttr {
@@ -959,6 +999,7 @@ def ConstInit : InheritableAttr {
let Accessors = [Accessor<"isConstinit", [Keyword<"constinit">]>];
let Documentation = [ConstInitDocs];
let LangOpts = [CPlusPlus];
+ let SimpleHandler = 1;
}
def Constructor : InheritableAttr {
@@ -1008,28 +1049,25 @@ def CUDADevice : InheritableAttr {
let Documentation = [Undocumented];
}
-def HIPPinnedShadow : InheritableAttr {
- let Spellings = [GNU<"hip_pinned_shadow">, Declspec<"__hip_pinned_shadow__">];
- let Subjects = SubjectList<[Var]>;
- let LangOpts = [HIP];
- let Documentation = [HIPPinnedShadowDocs];
-}
-
def CUDADeviceBuiltin : IgnoredAttr {
let Spellings = [GNU<"device_builtin">, Declspec<"__device_builtin__">];
let LangOpts = [CUDA];
}
-def CUDADeviceBuiltinSurfaceType : IgnoredAttr {
+def CUDADeviceBuiltinSurfaceType : InheritableAttr {
let Spellings = [GNU<"device_builtin_surface_type">,
Declspec<"__device_builtin_surface_type__">];
let LangOpts = [CUDA];
+ let Subjects = SubjectList<[CXXRecord]>;
+ let Documentation = [CUDADeviceBuiltinSurfaceTypeDocs];
}
-def CUDADeviceBuiltinTextureType : IgnoredAttr {
+def CUDADeviceBuiltinTextureType : InheritableAttr {
let Spellings = [GNU<"device_builtin_texture_type">,
Declspec<"__device_builtin_texture_type__">];
let LangOpts = [CUDA];
+ let Subjects = SubjectList<[CXXRecord]>;
+ let Documentation = [CUDADeviceBuiltinTextureTypeDocs];
}
def CUDAGlobal : InheritableAttr {
@@ -1089,6 +1127,7 @@ def CXX11NoReturn : InheritableAttr {
let Spellings = [CXX11<"", "noreturn", 200809>];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [CXX11NoReturnDocs];
+ let SimpleHandler = 1;
}
// Similar to CUDA, OpenCL attributes do not receive a [[]] spelling because
@@ -1097,6 +1136,7 @@ def OpenCLKernel : InheritableAttr {
let Spellings = [Keyword<"__kernel">, Keyword<"kernel">];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def OpenCLUnrollHint : InheritableAttr {
@@ -1166,6 +1206,7 @@ def RenderScriptKernel : Attr {
let Subjects = SubjectList<[Function]>;
let Documentation = [RenderScriptKernelAttributeDocs];
let LangOpts = [RenderScript];
+ let SimpleHandler = 1;
}
def Deprecated : InheritableAttr {
@@ -1190,6 +1231,7 @@ def EmptyBases : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> {
let Spellings = [Declspec<"empty_bases">];
let Subjects = SubjectList<[CXXRecord]>;
let Documentation = [EmptyBasesDocs];
+ let SimpleHandler = 1;
}
def AllocSize : InheritableAttr {
@@ -1232,6 +1274,11 @@ def FallThrough : StmtAttr {
let Documentation = [FallthroughDocs];
}
+def NoMerge : StmtAttr {
+ let Spellings = [Clang<"nomerge">];
+ let Documentation = [NoMergeDocs];
+}
+
def FastCall : DeclOrTypeAttr {
let Spellings = [GCC<"fastcall">, Keyword<"__fastcall">,
Keyword<"_fastcall">];
@@ -1261,6 +1308,7 @@ def FlagEnum : InheritableAttr {
let Spellings = [Clang<"flag_enum">];
let Subjects = SubjectList<[Enum]>;
let Documentation = [FlagEnumDocs];
+ let SimpleHandler = 1;
}
def EnumExtensibility : InheritableAttr {
@@ -1275,6 +1323,7 @@ def Flatten : InheritableAttr {
let Spellings = [GCC<"flatten">];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [FlattenDocs];
+ let SimpleHandler = 1;
}
def Format : InheritableAttr {
@@ -1320,6 +1369,7 @@ def IBAction : InheritableAttr {
// of the compiler. However, this node needs to exist in the AST because
// external tools rely on it.
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def IBOutlet : InheritableAttr {
@@ -1360,6 +1410,7 @@ def LifetimeBound : DeclOrTypeAttr {
let Subjects = SubjectList<[ParmVar, ImplicitObjectParameter], ErrorDiag>;
let Documentation = [LifetimeBoundDocs];
let LangOpts = [CPlusPlus];
+ let SimpleHandler = 1;
}
def TrivialABI : InheritableAttr {
@@ -1369,6 +1420,7 @@ def TrivialABI : InheritableAttr {
let Subjects = SubjectList<[CXXRecord]>;
let Documentation = [TrivialABIDocs];
let LangOpts = [CPlusPlus];
+ let SimpleHandler = 1;
}
def MaxFieldAlignment : InheritableAttr {
@@ -1383,6 +1435,7 @@ def MayAlias : InheritableAttr {
// FIXME: this is a type attribute in GCC, but a declaration attribute here.
let Spellings = [GCC<"may_alias">];
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def MIGServerRoutine : InheritableAttr {
@@ -1479,16 +1532,23 @@ def NeonVectorType : TypeAttr {
let ASTNode = 0;
}
+def ArmMveStrictPolymorphism : TypeAttr, TargetSpecificAttr<TargetARM> {
+ let Spellings = [Clang<"__clang_arm_mve_strict_polymorphism">];
+ let Documentation = [ArmMveStrictPolymorphismDocs];
+}
+
def NoUniqueAddress : InheritableAttr, TargetSpecificAttr<TargetItaniumCXXABI> {
let Spellings = [CXX11<"", "no_unique_address", 201803>];
let Subjects = SubjectList<[NonBitField], ErrorDiag>;
let Documentation = [NoUniqueAddressDocs];
+ let SimpleHandler = 1;
}
def ReturnsTwice : InheritableAttr {
let Spellings = [GCC<"returns_twice">];
let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def DisableTailCalls : InheritableAttr {
@@ -1501,12 +1561,14 @@ def NoAlias : InheritableAttr {
let Spellings = [Declspec<"noalias">];
let Subjects = SubjectList<[Function]>;
let Documentation = [NoAliasDocs];
+ let SimpleHandler = 1;
}
def NoCommon : InheritableAttr {
let Spellings = [GCC<"nocommon">];
let Subjects = SubjectList<[Var]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def NoDebug : InheritableAttr {
@@ -1519,30 +1581,35 @@ def NoDuplicate : InheritableAttr {
let Spellings = [Clang<"noduplicate">];
let Subjects = SubjectList<[Function]>;
let Documentation = [NoDuplicateDocs];
+ let SimpleHandler = 1;
}
def Convergent : InheritableAttr {
let Spellings = [Clang<"convergent">];
let Subjects = SubjectList<[Function]>;
let Documentation = [ConvergentDocs];
+ let SimpleHandler = 1;
}
def NoInline : InheritableAttr {
let Spellings = [GCC<"noinline">, Declspec<"noinline">];
let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def NoMips16 : InheritableAttr, TargetSpecificAttr<TargetMips32> {
let Spellings = [GCC<"nomips16">];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def NoMicroMips : InheritableAttr, TargetSpecificAttr<TargetMips32> {
let Spellings = [GCC<"nomicromips">];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [MicroMipsDocs];
+ let SimpleHandler = 1;
}
def RISCVInterrupt : InheritableAttr, TargetSpecificAttr<TargetRISCV> {
@@ -1637,6 +1704,7 @@ def NoSplitStack : InheritableAttr {
let Spellings = [GCC<"no_split_stack">];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [NoSplitStackDocs];
+ let SimpleHandler = 1;
}
def NonNull : InheritableParamAttr {
@@ -1734,6 +1802,7 @@ def NoInstrumentFunction : InheritableAttr {
let Spellings = [GCC<"no_instrument_function">];
let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def NotTailCalled : InheritableAttr {
@@ -1746,6 +1815,7 @@ def NoStackProtector : InheritableAttr {
let Spellings = [Clang<"no_stack_protector">];
let Subjects = SubjectList<[Function]>;
let Documentation = [NoStackProtectorDocs];
+ let SimpleHandler = 1;
}
def NoThrow : InheritableAttr {
@@ -1808,6 +1878,7 @@ def NSConsumesSelf : InheritableAttr {
let Spellings = [Clang<"ns_consumes_self">];
let Subjects = SubjectList<[ObjCMethod]>;
let Documentation = [RetainBehaviorDocs];
+ let SimpleHandler = 1;
}
def NSConsumed : InheritableParamAttr {
@@ -1820,6 +1891,7 @@ def ObjCException : InheritableAttr {
let Spellings = [Clang<"objc_exception">];
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def ObjCMethodFamily : InheritableAttr {
@@ -1864,6 +1936,7 @@ def ObjCRootClass : InheritableAttr {
let Spellings = [Clang<"objc_root_class">];
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def ObjCNonLazyClass : Attr {
@@ -1871,12 +1944,14 @@ def ObjCNonLazyClass : Attr {
let Subjects = SubjectList<[ObjCInterface, ObjCImpl], ErrorDiag>;
let LangOpts = [ObjC];
let Documentation = [ObjCNonLazyClassDocs];
+ let SimpleHandler = 1;
}
def ObjCSubclassingRestricted : InheritableAttr {
let Spellings = [Clang<"objc_subclassing_restricted">];
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
let Documentation = [ObjCSubclassingRestrictedDocs];
+ let SimpleHandler = 1;
}
def ObjCExplicitProtocolImpl : InheritableAttr {
@@ -1900,7 +1975,7 @@ def ObjCDirect : Attr {
def ObjCDirectMembers : Attr {
let Spellings = [Clang<"objc_direct_members">];
- let Subjects = SubjectList<[ObjCImpl, ObjCCategory], ErrorDiag>;
+ let Subjects = SubjectList<[ObjCImpl, ObjCInterface, ObjCCategory], ErrorDiag>;
let LangOpts = [ObjC];
let Documentation = [ObjCDirectMembersDocs];
}
@@ -1916,6 +1991,7 @@ def ObjCRuntimeVisible : Attr {
let Spellings = [Clang<"objc_runtime_visible">];
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
let Documentation = [ObjCRuntimeVisibleDocs];
+ let SimpleHandler = 1;
}
def ObjCClassStub : Attr {
@@ -1923,6 +1999,7 @@ def ObjCClassStub : Attr {
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
let Documentation = [ObjCClassStubDocs];
let LangOpts = [ObjCNonFragileRuntime];
+ let SimpleHandler = 1;
}
def ObjCBoxable : Attr {
@@ -1941,6 +2018,7 @@ def Overloadable : Attr {
let Spellings = [Clang<"overloadable">];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [OverloadableDocs];
+ let SimpleHandler = 1;
}
def Override : InheritableAttr {
@@ -1998,6 +2076,7 @@ def AArch64VectorPcs: DeclOrTypeAttr {
def Pure : InheritableAttr {
let Spellings = [GCC<"pure">];
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def Regparm : TypeAttr {
@@ -2033,7 +2112,7 @@ def WorkGroupSizeHint : InheritableAttr {
}
def InitPriority : InheritableAttr {
- let Spellings = [GCC<"init_priority">];
+ let Spellings = [GCC<"init_priority", /*AllowInC*/0>];
let Args = [UnsignedArgument<"Priority">];
let Subjects = SubjectList<[Var], ErrorDiag>;
let Documentation = [Undocumented];
@@ -2306,7 +2385,7 @@ def DiagnoseIf : InheritableAttr {
["error", "warning"],
["DT_Error", "DT_Warning"]>,
BoolArgument<"ArgDependent", 0, /*fake*/ 1>,
- NamedArgument<"Parent", 0, /*fake*/ 1>];
+ DeclArgument<Named, "Parent", 0, /*fake*/ 1>];
let InheritEvenIfAlreadyPresent = 1;
let LateParsed = 1;
let AdditionalMembers = [{
@@ -2321,6 +2400,7 @@ def ArcWeakrefUnavailable : InheritableAttr {
let Spellings = [Clang<"objc_arc_weak_reference_unavailable">];
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def ObjCGC : TypeAttr {
@@ -2339,6 +2419,7 @@ def ObjCRequiresPropertyDefs : InheritableAttr {
let Spellings = [Clang<"objc_requires_property_definitions">];
let Subjects = SubjectList<[ObjCInterface], ErrorDiag>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def Unused : InheritableAttr {
@@ -2353,11 +2434,13 @@ def Used : InheritableAttr {
let Spellings = [GCC<"used">];
let Subjects = SubjectList<[NonLocalVar, Function, ObjCMethod]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def Uuid : InheritableAttr {
let Spellings = [Declspec<"uuid">, Microsoft<"uuid">];
- let Args = [StringArgument<"Guid">];
+ let Args = [StringArgument<"Guid">,
+ DeclArgument<MSGuid, "GuidDecl", 0, /*fake=*/1>];
let Subjects = SubjectList<[Record, Enum]>;
// FIXME: Allow expressing logical AND for LangOpts. Our condition should be:
// CPlusPlus && (MicrosoftExt || Borland)
@@ -2381,6 +2464,15 @@ def VecTypeHint : InheritableAttr {
let Documentation = [Undocumented];
}
+def MatrixType : TypeAttr {
+ let Spellings = [Clang<"matrix_type">];
+ let Subjects = SubjectList<[TypedefName], ErrorDiag>;
+ let Args = [ExprArgument<"NumRows">, ExprArgument<"NumColumns">];
+ let Documentation = [Undocumented];
+ let ASTNode = 0;
+ let PragmaAttributeSupport = 0;
+}
+
def Visibility : InheritableAttr {
let Clone = 0;
let Spellings = [GCC<"visibility">];
@@ -2414,6 +2506,7 @@ def WarnUnused : InheritableAttr {
let Spellings = [GCC<"warn_unused">];
let Subjects = SubjectList<[Record]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def WarnUnusedResult : InheritableAttr {
@@ -2436,6 +2529,7 @@ def Weak : InheritableAttr {
let Spellings = [GCC<"weak">];
let Subjects = SubjectList<[Var, Function, CXXRecord]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def WeakImport : InheritableAttr {
@@ -2455,6 +2549,7 @@ def LTOVisibilityPublic : InheritableAttr {
let Spellings = [Clang<"lto_visibility_public">];
let Subjects = SubjectList<[Record]>;
let Documentation = [LTOVisibilityDocs];
+ let SimpleHandler = 1;
}
def AnyX86Interrupt : InheritableAttr, TargetSpecificAttr<TargetAnyX86> {
@@ -2471,6 +2566,7 @@ def AnyX86NoCallerSavedRegisters : InheritableAttr,
TargetSpecificAttr<TargetAnyX86> {
let Spellings = [GCC<"no_caller_saved_registers">];
let Documentation = [AnyX86NoCallerSavedRegistersDocs];
+ let SimpleHandler = 1;
}
def AnyX86NoCfCheck : DeclOrTypeAttr, TargetSpecificAttr<TargetAnyX86>{
@@ -2522,6 +2618,7 @@ def CFICanonicalJumpTable : InheritableAttr {
let Spellings = [Clang<"cfi_canonical_jump_table">];
let Subjects = SubjectList<[Function], ErrorDiag>;
let Documentation = [CFICanonicalJumpTableDocs];
+ let SimpleHandler = 1;
}
// C/C++ Thread safety attributes (e.g. for deadlock, data race checking)
@@ -2534,6 +2631,7 @@ def GuardedVar : InheritableAttr {
let Spellings = [Clang<"guarded_var", 0>];
let Subjects = SubjectList<[Field, SharedVar]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def PtGuardedVar : InheritableAttr {
@@ -2553,6 +2651,7 @@ def ScopedLockable : InheritableAttr {
let Spellings = [Clang<"scoped_lockable", 0>];
let Subjects = SubjectList<[Record]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def Capability : InheritableAttr {
@@ -2562,10 +2661,6 @@ def Capability : InheritableAttr {
let Accessors = [Accessor<"isShared",
[Clang<"shared_capability", 0>]>];
let Documentation = [Undocumented];
- let AdditionalMembers = [{
- bool isMutex() const { return getName().equals_lower("mutex"); }
- bool isRole() const { return getName().equals_lower("role"); }
- }];
}
def AssertCapability : InheritableAttr {
@@ -2653,6 +2748,7 @@ def NoThreadSafetyAnalysis : InheritableAttr {
let Spellings = [Clang<"no_thread_safety_analysis">];
let Subjects = SubjectList<[Function]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def GuardedBy : InheritableAttr {
@@ -2789,6 +2885,7 @@ def ConsumableAutoCast : InheritableAttr {
let Spellings = [Clang<"consumable_auto_cast_state", 0>];
let Subjects = SubjectList<[CXXRecord]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def ConsumableSetOnRead : InheritableAttr {
@@ -2798,6 +2895,7 @@ def ConsumableSetOnRead : InheritableAttr {
let Spellings = [Clang<"consumable_set_state_on_read", 0>];
let Subjects = SubjectList<[CXXRecord]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def CallableWhen : InheritableAttr {
@@ -2904,6 +3002,7 @@ def MSNoVTable : InheritableAttr, TargetSpecificAttr<TargetMicrosoftCXXABI> {
let Spellings = [Declspec<"novtable">];
let Subjects = SubjectList<[CXXRecord]>;
let Documentation = [MSNoVTableDocs];
+ let SimpleHandler = 1;
}
def : IgnoredAttr {
@@ -2929,6 +3028,7 @@ def MSStruct : InheritableAttr {
let Spellings = [GCC<"ms_struct">];
let Subjects = SubjectList<[Record]>;
let Documentation = [Undocumented];
+ let SimpleHandler = 1;
}
def DLLExport : InheritableAttr, TargetSpecificAttr<TargetWindows> {
@@ -2977,6 +3077,7 @@ def DLLImportStaticLocal : InheritableAttr, TargetSpecificAttr<TargetWindows> {
def SelectAny : InheritableAttr {
let Spellings = [Declspec<"selectany">, GCC<"selectany">];
let Documentation = [SelectAnyDocs];
+ let SimpleHandler = 1;
}
def Thread : Attr {
@@ -3108,57 +3209,14 @@ def LoopHint : Attr {
llvm_unreachable("Unhandled LoopHint option.");
}
- void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
- unsigned SpellingIndex = getAttributeSpellingListIndex();
- // For "#pragma unroll" and "#pragma nounroll" the string "unroll" or
- // "nounroll" is already emitted as the pragma name.
- if (SpellingIndex == Pragma_nounroll || SpellingIndex == Pragma_nounroll_and_jam)
- return;
- else if (SpellingIndex == Pragma_unroll || SpellingIndex == Pragma_unroll_and_jam) {
- OS << ' ' << getValueString(Policy);
- return;
- }
-
- assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
- OS << ' ' << getOptionName(option) << getValueString(Policy);
- }
+ void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const;
// Return a string containing the loop hint argument including the
// enclosing parentheses.
- std::string getValueString(const PrintingPolicy &Policy) const {
- std::string ValueName;
- llvm::raw_string_ostream OS(ValueName);
- OS << "(";
- if (state == Numeric)
- value->printPretty(OS, nullptr, Policy);
- else if (state == Enable)
- OS << "enable";
- else if (state == Full)
- OS << "full";
- else if (state == AssumeSafety)
- OS << "assume_safety";
- else
- OS << "disable";
- OS << ")";
- return OS.str();
- }
+ std::string getValueString(const PrintingPolicy &Policy) const;
// Return a string suitable for identifying this attribute in diagnostics.
- std::string getDiagnosticName(const PrintingPolicy &Policy) const {
- unsigned SpellingIndex = getAttributeSpellingListIndex();
- if (SpellingIndex == Pragma_nounroll)
- return "#pragma nounroll";
- else if (SpellingIndex == Pragma_unroll)
- return "#pragma unroll" + (option == UnrollCount ? getValueString(Policy) : "");
- else if (SpellingIndex == Pragma_nounroll_and_jam)
- return "#pragma nounroll_and_jam";
- else if (SpellingIndex == Pragma_unroll_and_jam)
- return "#pragma unroll_and_jam" +
- (option == UnrollAndJamCount ? getValueString(Policy) : "");
-
- assert(SpellingIndex == Pragma_clang_loop && "Unexpected spelling");
- return getOptionName(option) + getValueString(Policy);
- }
+ std::string getDiagnosticName(const PrintingPolicy &Policy) const;
}];
let Documentation = [LoopHintDocs, UnrollHintDocs];
@@ -3189,8 +3247,13 @@ def OMPCaptureKind : Attr {
// This attribute has no spellings as it is only ever created implicitly.
let Spellings = [];
let SemaHandler = 0;
- let Args = [UnsignedArgument<"CaptureKind">];
+ let Args = [UnsignedArgument<"CaptureKindVal">];
let Documentation = [Undocumented];
+ let AdditionalMembers = [{
+ llvm::omp::Clause getCaptureKind() const {
+ return static_cast<llvm::omp::Clause>(getCaptureKindVal());
+ }
+ }];
}
def OMPReferencedVar : Attr {
@@ -3218,53 +3281,7 @@ def OMPDeclareSimdDecl : Attr {
];
let AdditionalMembers = [{
void printPrettyPragma(raw_ostream & OS, const PrintingPolicy &Policy)
- const {
- if (getBranchState() != BS_Undefined)
- OS << ' ' << ConvertBranchStateTyToStr(getBranchState());
- if (auto *E = getSimdlen()) {
- OS << " simdlen(";
- E->printPretty(OS, nullptr, Policy);
- OS << ")";
- }
- if (uniforms_size() > 0) {
- OS << " uniform";
- StringRef Sep = "(";
- for (auto *E : uniforms()) {
- OS << Sep;
- E->printPretty(OS, nullptr, Policy);
- Sep = ", ";
- }
- OS << ")";
- }
- alignments_iterator NI = alignments_begin();
- for (auto *E : aligneds()) {
- OS << " aligned(";
- E->printPretty(OS, nullptr, Policy);
- if (*NI) {
- OS << ": ";
- (*NI)->printPretty(OS, nullptr, Policy);
- }
- OS << ")";
- ++NI;
- }
- steps_iterator I = steps_begin();
- modifiers_iterator MI = modifiers_begin();
- for (auto *E : linears()) {
- OS << " linear(";
- if (*MI != OMPC_LINEAR_unknown)
- OS << getOpenMPSimpleClauseTypeName(OMPC_linear, *MI) << "(";
- E->printPretty(OS, nullptr, Policy);
- if (*MI != OMPC_LINEAR_unknown)
- OS << ")";
- if (*I) {
- OS << ": ";
- (*I)->printPretty(OS, nullptr, Policy);
- }
- OS << ")";
- ++I;
- ++MI;
- }
- }
+ const;
}];
}
@@ -3282,30 +3299,10 @@ def OMPDeclareTargetDecl : InheritableAttr {
[ "DT_Host", "DT_NoHost", "DT_Any" ]>
];
let AdditionalMembers = [{
- void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const {
- // Use fake syntax because it is for testing and debugging purpose only.
- if (getDevType() != DT_Any)
- OS << " device_type(" << ConvertDevTypeTyToStr(getDevType()) << ")";
- if (getMapType() != MT_To)
- OS << ' ' << ConvertMapTypeTyToStr(getMapType());
- }
+ void printPrettyPragma(raw_ostream &OS, const PrintingPolicy &Policy) const;
static llvm::Optional<MapTypeTy>
- isDeclareTargetDeclaration(const ValueDecl *VD) {
- if (!VD->hasAttrs())
- return llvm::None;
- if (const auto *Attr = VD->getAttr<OMPDeclareTargetDeclAttr>())
- return Attr->getMapType();
-
- return llvm::None;
- }
- static llvm::Optional<DevTypeTy> getDeviceType(const ValueDecl *VD) {
- if (!VD->hasAttrs())
- return llvm::None;
- if (const auto *Attr = VD->getAttr<OMPDeclareTargetDeclAttr>())
- return Attr->getDevType();
-
- return llvm::None;
- }
+ isDeclareTargetDeclaration(const ValueDecl *VD);
+ static llvm::Optional<DevTypeTy> getDeviceType(const ValueDecl *VD);
}];
}
@@ -3316,14 +3313,16 @@ def OMPAllocateDecl : InheritableAttr {
let Args = [
EnumArgument<"AllocatorType", "AllocatorTypeTy",
[
- "omp_default_mem_alloc", "omp_large_cap_mem_alloc",
- "omp_const_mem_alloc", "omp_high_bw_mem_alloc",
- "omp_low_lat_mem_alloc", "omp_cgroup_mem_alloc",
- "omp_pteam_mem_alloc", "omp_thread_mem_alloc", ""
+ "omp_null_allocator", "omp_default_mem_alloc",
+ "omp_large_cap_mem_alloc", "omp_const_mem_alloc",
+ "omp_high_bw_mem_alloc", "omp_low_lat_mem_alloc",
+ "omp_cgroup_mem_alloc", "omp_pteam_mem_alloc",
+ "omp_thread_mem_alloc", ""
],
[
- "OMPDefaultMemAlloc", "OMPLargeCapMemAlloc",
- "OMPConstMemAlloc", "OMPHighBWMemAlloc", "OMPLowLatMemAlloc",
+ "OMPNullMemAlloc", "OMPDefaultMemAlloc",
+ "OMPLargeCapMemAlloc", "OMPConstMemAlloc",
+ "OMPHighBWMemAlloc", "OMPLowLatMemAlloc",
"OMPCGroupMemAlloc", "OMPPTeamMemAlloc", "OMPThreadMemAlloc",
"OMPUserDefinedMemAlloc"
]>,
@@ -3341,89 +3340,12 @@ def OMPDeclareVariant : InheritableAttr {
let Documentation = [OMPDeclareVariantDocs];
let Args = [
ExprArgument<"VariantFuncRef">,
- VariadicExprArgument<"Scores">,
- VariadicUnsignedArgument<"CtxSelectorSets">,
- VariadicUnsignedArgument<"CtxSelectors">,
- VariadicStringArgument<"ImplVendors">,
- VariadicStringArgument<"DeviceKinds">
+ OMPTraitInfoArgument<"TraitInfos">,
];
let AdditionalMembers = [{
- void printScore(raw_ostream & OS, const PrintingPolicy &Policy, unsigned I) const {
- if (const Expr *E = *std::next(scores_begin(), I)) {
- OS << "score(";
- E->printPretty(OS, nullptr, Policy);
- OS << "):";
- }
- }
+ OMPTraitInfo &getTraitInfo() { return *traitInfos; }
void printPrettyPragma(raw_ostream & OS, const PrintingPolicy &Policy)
- const {
- if (const Expr *E = getVariantFuncRef()) {
- OS << "(";
- E->printPretty(OS, nullptr, Policy);
- OS << ")";
- }
- // TODO: add printing of real context selectors.
- OS << " match(";
- int Used[OMP_CTX_SET_unknown] = {0};
- for (unsigned I = 0, E = ctxSelectorSets_size(); I < E; ++I) {
- auto CtxSet = static_cast<OpenMPContextSelectorSetKind>(
- *std::next(ctxSelectorSets_begin(), I));
- if (Used[CtxSet])
- continue;
- if (I > 0)
- OS << ",";
- switch (CtxSet) {
- case OMP_CTX_SET_implementation:
- OS << "implementation={";
- break;
- case OMP_CTX_SET_device:
- OS << "device={";
- break;
- case OMP_CTX_SET_unknown:
- llvm_unreachable("Unknown context selector set.");
- }
- Used[CtxSet] = 1;
- for (unsigned K = I, EK = ctxSelectors_size(); K < EK; ++K) {
- auto CtxSetK = static_cast<OpenMPContextSelectorSetKind>(
- *std::next(ctxSelectorSets_begin(), K));
- if (CtxSet != CtxSetK)
- continue;
- if (K != I)
- OS << ",";
- auto Ctx = static_cast<OpenMPContextSelectorKind>(
- *std::next(ctxSelectors_begin(), K));
- switch (Ctx) {
- case OMP_CTX_vendor:
- assert(CtxSet == OMP_CTX_SET_implementation &&
- "Expected implementation context selector set.");
- OS << "vendor(";
- printScore(OS, Policy, K);
- if (implVendors_size() > 0) {
- OS << *implVendors(). begin();
- for (StringRef VendorName : llvm::drop_begin(implVendors(), 1))
- OS << ", " << VendorName;
- }
- OS << ")";
- break;
- case OMP_CTX_kind:
- assert(CtxSet == OMP_CTX_SET_device &&
- "Expected device context selector set.");
- OS << "kind(";
- if (deviceKinds_size() > 0) {
- OS << *deviceKinds().begin();
- for (StringRef KindName : llvm::drop_begin(deviceKinds(), 1))
- OS << ", " << KindName;
- }
- OS << ")";
- break;
- case OMP_CTX_unknown:
- llvm_unreachable("Unknown context selector.");
- }
- }
- OS << "}";
- }
- OS << ")";
- }
+ const;
}];
}
@@ -3438,12 +3360,14 @@ def ExcludeFromExplicitInstantiation : InheritableAttr {
let Subjects = SubjectList<[Var, Function, CXXRecord]>;
let Documentation = [ExcludeFromExplicitInstantiationDocs];
let MeaningfulToClassTemplateDefinition = 1;
+ let SimpleHandler = 1;
}
def Reinitializes : InheritableAttr {
let Spellings = [Clang<"reinitializes", 0>];
let Subjects = SubjectList<[NonStaticNonConstCXXMethod], ErrorDiag>;
let Documentation = [ReinitializesDocs];
+ let SimpleHandler = 1;
}
def NoDestroy : InheritableAttr {
@@ -3473,9 +3397,16 @@ def NoSpeculativeLoadHardening : InheritableAttr {
def Uninitialized : InheritableAttr {
let Spellings = [Clang<"uninitialized", 0>];
let Subjects = SubjectList<[LocalVar]>;
+ let PragmaAttributeSupport = 1;
let Documentation = [UninitializedDocs];
}
+def LoaderUninitialized : Attr {
+ let Spellings = [Clang<"loader_uninitialized">];
+ let Subjects = SubjectList<[GlobalVar]>;
+ let Documentation = [LoaderUninitializedDocs];
+}
+
def ObjCExternallyRetained : InheritableAttr {
let LangOpts = [ObjCAutoRefCount];
let Spellings = [Clang<"objc_externally_retained">];