1 ////////////////////////////////////////////////////////////////////////////////
2 // Note: This file is a work in progress. Please do not apply non-trivial
3 // updates unless you have talked to Sean Hunt <rideau3@gmail.com> prior.
4 // Merely adding a new attribute is a trivial update.
5 ////////////////////////////////////////////////////////////////////////////////
7 // An attribute's subject is whatever it appertains to. In this file, it is
8 // more accurately a list of things that an attribute can appertain to. All
9 // Decls and Stmts are possibly AttrSubjects (even though the syntax may not
10 // allow attributes on a given Decl or Stmt).
13 include "clang/Basic/DeclNodes.td"
14 include "clang/Basic/StmtNodes.td"
16 // A subset-subject is an AttrSubject constrained to operate only on some subset
19 // The description is used in output messages to specify what the subject
20 // represents. FIXME: Deal with translation issues.
22 // The code fragment is a boolean expression that will confirm that the subject
23 // meets the requirements; the subject will have the name S, and will have the
24 // type specified by the base. It should be a simple boolean expression.
25 class SubsetSubject<AttrSubject base, string description, code check>
27 AttrSubject Base = base;
28 string Description = description;
29 code CheckCode = check;
32 // This is the type of a variable which C++0x defines [[aligned()]] as being
33 // a possible subject.
34 def NormalVar : SubsetSubject<Var, "non-register, non-parameter variable",
35 [{S->getStorageClass() != VarDecl::Register &&
36 S->getKind() != Decl::ImplicitParam &&
37 S->getKind() != Decl::ParmVar &&
38 S->getKind() != Decl::NonTypeTemplateParm}]>;
39 def CXXVirtualMethod : SubsetSubject<CXXRecord, "virtual member function",
41 def NonBitField : SubsetSubject<Field, "non-bit field",
42 [{!S->isBitField()}]>;
44 // A single argument to an attribute
45 class Argument<string name> {
49 class BoolArgument<string name> : Argument<name>;
50 class IdentifierArgument<string name> : Argument<name>;
51 class IntArgument<string name> : Argument<name>;
52 class StringArgument<string name> : Argument<name>;
53 class ExprArgument<string name> : Argument<name>;
54 class FunctionArgument<string name> : Argument<name>;
55 class TypeArgument<string name> : Argument<name>;
56 class UnsignedArgument<string name> : Argument<name>;
57 class SourceLocArgument<string name> : Argument<name>;
58 class VariadicUnsignedArgument<string name> : Argument<name>;
59 class VariadicExprArgument<string name> : Argument<name>;
61 // A version of the form major.minor[.subminor].
62 class VersionArgument<string name> : Argument<name>;
64 // This one's a doozy, so it gets its own special type
65 // It can be an unsigned integer, or a type. Either can
67 class AlignedArgument<string name> : Argument<name>;
69 // An integer argument with a default value
70 class DefaultIntArgument<string name, int default> : IntArgument<name> {
71 int Default = default;
74 // This argument is more complex, it includes the enumerator type name,
75 // a list of strings to accept, and a list of enumerators to map them to.
76 class EnumArgument<string name, string type, list<string> values,
77 list<string> enums> : Argument<name> {
79 list<string> Values = values;
80 list<string> Enums = enums;
83 // This handles one spelling of an attribute.
84 class Spelling<string name, string variety> {
86 string Variety = variety;
89 class GNU<string name> : Spelling<name, "GNU">;
90 class Declspec<string name> : Spelling<name, "Declspec">;
91 class CXX11<string namespace, string name> : Spelling<name, "CXX11"> {
92 string Namespace = namespace;
96 // The various ways in which an attribute can be spelled in source
97 list<Spelling> Spellings;
98 // The things to which an attribute can appertain
99 list<AttrSubject> Subjects;
100 // The arguments allowed on an attribute
101 list<Argument> Args = [];
102 // Set to true for attributes with arguments which require delayed parsing.
104 // Set to false to prevent an attribute from being propagated from a template
105 // to the instantiation.
107 // Set to true for attributes which must be instantiated within templates
108 bit TemplateDependent = 0;
109 // Set to true for attributes that have a corresponding AST node.
111 // Set to true for attributes which have handler in Sema.
113 // Set to true for attributes that are completely ignored.
115 // Set to true if each of the spellings is a distinct attribute.
116 bit DistinctSpellings = 0;
117 // Any additional text that should be included verbatim in the class.
118 code AdditionalMembers = [{}];
121 /// An inheritable attribute is inherited by later redeclarations.
122 class InheritableAttr : Attr;
124 /// An inheritable parameter attribute is inherited by later
125 /// redeclarations, even when it's written on a parameter.
126 class InheritableParamAttr : InheritableAttr;
129 // Attributes begin here
132 def AddressSpace : Attr {
133 let Spellings = [GNU<"address_space">];
134 let Args = [IntArgument<"AddressSpace">];
138 def Alias : InheritableAttr {
139 let Spellings = [GNU<"alias">];
140 let Args = [StringArgument<"Aliasee">];
143 def Aligned : InheritableAttr {
144 let Spellings = [GNU<"aligned">, GNU<"align">];
145 let Subjects = [NonBitField, NormalVar, Tag];
146 let Args = [AlignedArgument<"Alignment">, BoolArgument<"IsMSDeclSpec">];
149 def AlignMac68k : InheritableAttr {
154 def AllocSize : Attr {
155 let Spellings = [GNU<"alloc_size">];
156 let Args = [VariadicUnsignedArgument<"Args">];
159 def AlwaysInline : InheritableAttr {
160 let Spellings = [GNU<"always_inline">];
163 def TLSModel : InheritableAttr {
164 let Spellings = [GNU<"tls_model">];
165 let Subjects = [Var];
166 let Args = [StringArgument<"Model">];
169 def AnalyzerNoReturn : InheritableAttr {
170 let Spellings = [GNU<"analyzer_noreturn">];
173 def Annotate : InheritableParamAttr {
174 let Spellings = [GNU<"annotate">];
175 let Args = [StringArgument<"Annotation">];
178 def AsmLabel : InheritableAttr {
180 let Args = [StringArgument<"Label">];
184 def Availability : InheritableAttr {
185 let Spellings = [GNU<"availability">];
186 let Args = [IdentifierArgument<"platform">, VersionArgument<"introduced">,
187 VersionArgument<"deprecated">, VersionArgument<"obsoleted">,
188 BoolArgument<"unavailable">, StringArgument<"message">];
189 let AdditionalMembers =
190 [{static llvm::StringRef getPrettyPlatformName(llvm::StringRef Platform) {
191 return llvm::StringSwitch<llvm::StringRef>(Platform)
193 .Case("macosx", "OS X")
194 .Default(llvm::StringRef());
198 def Blocks : InheritableAttr {
199 let Spellings = [GNU<"blocks">];
200 let Args = [EnumArgument<"Type", "BlockType", ["byref"], ["ByRef"]>];
204 let Spellings = [GNU<"bounded">];
210 def CarriesDependency : InheritableParamAttr {
211 let Spellings = [GNU<"carries_dependency">, CXX11<"","carries_dependency">,
212 CXX11<"std","carries_dependency">];
213 let Subjects = [ParmVar, Function];
216 def CDecl : InheritableAttr {
217 let Spellings = [GNU<"cdecl">, GNU<"__cdecl">];
220 // cf_audited_transfer indicates that the given function has been
221 // audited and has been marked with the appropriate cf_consumed and
222 // cf_returns_retained attributes. It is generally applied by
223 // '#pragma clang arc_cf_code_audited' rather than explicitly.
224 def CFAuditedTransfer : InheritableAttr {
225 let Spellings = [GNU<"cf_audited_transfer">];
226 let Subjects = [Function];
229 // cf_unknown_transfer is an explicit opt-out of cf_audited_transfer.
230 // It indicates that the function has unknown or unautomatable
231 // transfer semantics.
232 def CFUnknownTransfer : InheritableAttr {
233 let Spellings = [GNU<"cf_unknown_transfer">];
234 let Subjects = [Function];
237 def CFReturnsAutoreleased : Attr {
238 let Spellings = [GNU<"cf_returns_autoreleased">];
242 def CFReturnsRetained : InheritableAttr {
243 let Spellings = [GNU<"cf_returns_retained">];
244 let Subjects = [ObjCMethod, Function];
247 def CFReturnsNotRetained : InheritableAttr {
248 let Spellings = [GNU<"cf_returns_not_retained">];
249 let Subjects = [ObjCMethod, Function];
252 def CFConsumed : InheritableParamAttr {
253 let Spellings = [GNU<"cf_consumed">];
254 let Subjects = [ParmVar];
257 def Cleanup : InheritableAttr {
258 let Spellings = [GNU<"cleanup">];
259 let Args = [FunctionArgument<"FunctionDecl">];
262 def Cold : InheritableAttr {
263 let Spellings = [GNU<"cold">];
266 def Common : InheritableAttr {
267 let Spellings = [GNU<"common">];
270 def Const : InheritableAttr {
271 let Spellings = [GNU<"const">, GNU<"__const">];
274 def Constructor : InheritableAttr {
275 let Spellings = [GNU<"constructor">];
276 let Args = [IntArgument<"Priority">];
279 def CUDAConstant : InheritableAttr {
280 let Spellings = [GNU<"constant">];
283 def CUDADevice : InheritableAttr {
284 let Spellings = [GNU<"device">];
287 def CUDAGlobal : InheritableAttr {
288 let Spellings = [GNU<"global">];
291 def CUDAHost : InheritableAttr {
292 let Spellings = [GNU<"host">];
295 def CUDALaunchBounds : InheritableAttr {
296 let Spellings = [GNU<"launch_bounds">];
297 let Args = [IntArgument<"MaxThreads">, DefaultIntArgument<"MinBlocks", 0>];
300 def CUDAShared : InheritableAttr {
301 let Spellings = [GNU<"shared">];
304 def OpenCLKernel : Attr {
305 let Spellings = [GNU<"opencl_kernel_function">];
308 def OpenCLImageAccess : Attr {
309 let Spellings = [GNU<"opencl_image_access">];
310 let Args = [IntArgument<"Access">];
314 def Deprecated : InheritableAttr {
315 let Spellings = [GNU<"deprecated">];
316 let Args = [StringArgument<"Message">];
319 def Destructor : InheritableAttr {
320 let Spellings = [GNU<"destructor">];
321 let Args = [IntArgument<"Priority">];
324 def ExtVectorType : Attr {
325 let Spellings = [GNU<"ext_vector_type">];
326 let Args = [ExprArgument<"NumElements">];
330 def FallThrough : Attr {
331 let Spellings = [CXX11<"clang","fallthrough">];
332 let Subjects = [NullStmt];
335 def FastCall : InheritableAttr {
336 let Spellings = [GNU<"fastcall">, GNU<"__fastcall">];
339 def Final : InheritableAttr {
344 def MinSize : InheritableAttr {
345 let Spellings = [GNU<"minsize">];
346 let Subjects = [Function];
349 def Format : InheritableAttr {
350 let Spellings = [GNU<"format">];
351 let Args = [StringArgument<"Type">, IntArgument<"FormatIdx">,
352 IntArgument<"FirstArg">];
355 def FormatArg : InheritableAttr {
356 let Spellings = [GNU<"format_arg">];
357 let Args = [IntArgument<"FormatIdx">];
360 def GNUInline : InheritableAttr {
361 let Spellings = [GNU<"gnu_inline">];
364 def Hot : InheritableAttr {
365 let Spellings = [GNU<"hot">];
368 def IBAction : InheritableAttr {
369 let Spellings = [GNU<"ibaction">];
372 def IBOutlet : InheritableAttr {
373 let Spellings = [GNU<"iboutlet">];
376 def IBOutletCollection : InheritableAttr {
377 let Spellings = [GNU<"iboutletcollection">];
378 let Args = [TypeArgument<"Interface">, SourceLocArgument<"InterfaceLoc">];
381 def Malloc : InheritableAttr {
382 let Spellings = [GNU<"malloc">];
385 def MaxFieldAlignment : InheritableAttr {
387 let Args = [UnsignedArgument<"Alignment">];
391 def MayAlias : InheritableAttr {
392 let Spellings = [GNU<"may_alias">];
395 def MSP430Interrupt : InheritableAttr {
397 let Args = [UnsignedArgument<"Number">];
401 def MBlazeInterruptHandler : InheritableAttr {
406 def MBlazeSaveVolatiles : InheritableAttr {
412 let Spellings = [GNU<"mode">];
413 let Args = [IdentifierArgument<"Mode">];
417 def Naked : InheritableAttr {
418 let Spellings = [GNU<"naked">];
421 def NeonPolyVectorType : Attr {
422 let Spellings = [GNU<"neon_polyvector_type">];
423 let Args = [IntArgument<"NumElements">];
427 def NeonVectorType : Attr {
428 let Spellings = [GNU<"neon_vector_type">];
429 let Args = [IntArgument<"NumElements">];
433 def ReturnsTwice : InheritableAttr {
434 let Spellings = [GNU<"returns_twice">];
437 def NoCommon : InheritableAttr {
438 let Spellings = [GNU<"nocommon">];
441 def NoDebug : InheritableAttr {
442 let Spellings = [GNU<"nodebug">];
445 def NoInline : InheritableAttr {
446 let Spellings = [GNU<"noinline">];
449 def NonNull : InheritableAttr {
450 let Spellings = [GNU<"nonnull">];
451 let Args = [VariadicUnsignedArgument<"Args">];
452 let AdditionalMembers =
453 [{bool isNonNull(unsigned idx) const {
454 for (args_iterator i = args_begin(), e = args_end();
462 def NoReturn : InheritableAttr {
463 let Spellings = [GNU<"noreturn">, CXX11<"","noreturn">,
464 CXX11<"std","noreturn">];
465 // FIXME: Does GCC allow this on the function instead?
466 let Subjects = [Function];
469 def NoInstrumentFunction : InheritableAttr {
470 let Spellings = [GNU<"no_instrument_function">];
471 let Subjects = [Function];
474 def NoThrow : InheritableAttr {
475 let Spellings = [GNU<"nothrow">];
478 def NSBridged : InheritableAttr {
479 let Spellings = [GNU<"ns_bridged">];
480 let Subjects = [Record];
481 let Args = [IdentifierArgument<"BridgedType">];
484 def NSReturnsRetained : InheritableAttr {
485 let Spellings = [GNU<"ns_returns_retained">];
486 let Subjects = [ObjCMethod, Function];
489 def NSReturnsNotRetained : InheritableAttr {
490 let Spellings = [GNU<"ns_returns_not_retained">];
491 let Subjects = [ObjCMethod, Function];
494 def NSReturnsAutoreleased : InheritableAttr {
495 let Spellings = [GNU<"ns_returns_autoreleased">];
496 let Subjects = [ObjCMethod, Function];
499 def NSConsumesSelf : InheritableAttr {
500 let Spellings = [GNU<"ns_consumes_self">];
501 let Subjects = [ObjCMethod];
504 def NSConsumed : InheritableParamAttr {
505 let Spellings = [GNU<"ns_consumed">];
506 let Subjects = [ParmVar];
509 def ObjCException : InheritableAttr {
510 let Spellings = [GNU<"objc_exception">];
513 def ObjCMethodFamily : InheritableAttr {
514 let Spellings = [GNU<"objc_method_family">];
515 let Subjects = [ObjCMethod];
516 let Args = [EnumArgument<"Family", "FamilyKind",
517 ["none", "alloc", "copy", "init", "mutableCopy", "new"],
518 ["OMF_None", "OMF_alloc", "OMF_copy", "OMF_init",
519 "OMF_mutableCopy", "OMF_new"]>];
522 def ObjCNSObject : InheritableAttr {
523 let Spellings = [GNU<"NSObject">];
526 def ObjCPreciseLifetime : Attr {
527 let Spellings = [GNU<"objc_precise_lifetime">];
528 let Subjects = [Var];
531 def ObjCReturnsInnerPointer : Attr {
532 let Spellings = [GNU<"objc_returns_inner_pointer">];
533 let Subjects = [ObjCMethod];
536 def ObjCRequiresSuper : InheritableAttr {
537 let Spellings = [GNU<"objc_requires_super">];
538 let Subjects = [ObjCMethod];
541 def ObjCRootClass : Attr {
542 let Spellings = [GNU<"objc_root_class">];
543 let Subjects = [ObjCInterface];
546 def Overloadable : Attr {
547 let Spellings = [GNU<"overloadable">];
550 def Override : InheritableAttr {
555 def Ownership : InheritableAttr {
556 let Spellings = [GNU<"ownership_holds">, GNU<"ownership_returns">,
557 GNU<"ownership_takes">];
558 let DistinctSpellings = 1;
559 let Args = [EnumArgument<"OwnKind", "OwnershipKind",
560 ["ownership_holds", "ownership_returns", "ownership_takes"],
561 ["Holds", "Returns", "Takes"]>,
562 StringArgument<"Module">, VariadicUnsignedArgument<"Args">];
565 def Packed : InheritableAttr {
566 let Spellings = [GNU<"packed">];
569 def PnaclCall : InheritableAttr {
570 let Spellings = [GNU<"pnaclcall">];
573 def Pcs : InheritableAttr {
574 let Spellings = [GNU<"pcs">];
575 let Args = [EnumArgument<"PCS", "PCSType",
576 ["aapcs", "aapcs-vfp"],
577 ["AAPCS", "AAPCS_VFP"]>];
580 def Pure : InheritableAttr {
581 let Spellings = [GNU<"pure">];
584 def Regparm : InheritableAttr {
585 let Spellings = [GNU<"regparm">];
586 let Args = [UnsignedArgument<"NumParams">];
589 def ReqdWorkGroupSize : InheritableAttr {
590 let Spellings = [GNU<"reqd_work_group_size">];
591 let Args = [UnsignedArgument<"XDim">, UnsignedArgument<"YDim">,
592 UnsignedArgument<"ZDim">];
595 def WorkGroupSizeHint : InheritableAttr {
596 let Spellings = [GNU<"work_group_size_hint">];
597 let Args = [UnsignedArgument<"XDim">,
598 UnsignedArgument<"YDim">,
599 UnsignedArgument<"ZDim">];
602 def InitPriority : InheritableAttr {
603 let Spellings = [GNU<"init_priority">];
604 let Args = [UnsignedArgument<"Priority">];
607 def Section : InheritableAttr {
608 let Spellings = [GNU<"section">];
609 let Args = [StringArgument<"Name">];
612 def Sentinel : InheritableAttr {
613 let Spellings = [GNU<"sentinel">];
614 let Args = [DefaultIntArgument<"Sentinel", 0>,
615 DefaultIntArgument<"NullPos", 0>];
618 def StdCall : InheritableAttr {
619 let Spellings = [GNU<"stdcall">, GNU<"__stdcall">];
622 def ThisCall : InheritableAttr {
623 let Spellings = [GNU<"thiscall">, GNU<"__thiscall">];
626 def Pascal : InheritableAttr {
627 let Spellings = [GNU<"pascal">];
630 def TransparentUnion : InheritableAttr {
631 let Spellings = [GNU<"transparent_union">];
634 def Unavailable : InheritableAttr {
635 let Spellings = [GNU<"unavailable">];
636 let Args = [StringArgument<"Message">];
639 def ArcWeakrefUnavailable : InheritableAttr {
640 let Spellings = [GNU<"objc_arc_weak_reference_unavailable">];
641 let Subjects = [ObjCInterface];
645 let Spellings = [GNU<"objc_gc">];
646 let Args = [IdentifierArgument<"Kind">];
650 def ObjCOwnership : Attr {
651 let Spellings = [GNU<"objc_ownership">];
652 let Args = [IdentifierArgument<"Kind">];
656 def ObjCRequiresPropertyDefs : InheritableAttr {
657 let Spellings = [GNU<"objc_requires_property_definitions">];
658 let Subjects = [ObjCInterface];
661 def Unused : InheritableAttr {
662 let Spellings = [GNU<"unused">];
665 def Used : InheritableAttr {
666 let Spellings = [GNU<"used">];
669 def Uuid : InheritableAttr {
670 let Spellings = [GNU<"uuid">];
671 let Args = [StringArgument<"Guid">];
672 let Subjects = [CXXRecord];
675 def VectorSize : Attr {
676 let Spellings = [GNU<"vector_size">];
677 let Args = [ExprArgument<"NumBytes">];
681 def VecTypeHint : Attr {
682 let Spellings = [GNU<"vec_type_hint">];
688 def Visibility : InheritableAttr {
690 let Spellings = [GNU<"visibility">];
691 let Args = [EnumArgument<"Visibility", "VisibilityType",
692 ["default", "hidden", "internal", "protected"],
693 ["Default", "Hidden", "Hidden", "Protected"]>];
696 def VecReturn : InheritableAttr {
697 let Spellings = [GNU<"vecreturn">];
698 let Subjects = [CXXRecord];
701 def WarnUnusedResult : InheritableAttr {
702 let Spellings = [GNU<"warn_unused_result">];
705 def Weak : InheritableAttr {
706 let Spellings = [GNU<"weak">];
709 def WeakImport : InheritableAttr {
710 let Spellings = [GNU<"weak_import">];
713 def WeakRef : InheritableAttr {
714 let Spellings = [GNU<"weakref">];
717 def X86ForceAlignArgPointer : InheritableAttr {
721 // AddressSafety attribute (e.g. for AddressSanitizer)
722 def NoAddressSafetyAnalysis : InheritableAttr {
723 let Spellings = [GNU<"no_address_safety_analysis">];
726 // C/C++ Thread safety attributes (e.g. for deadlock, data race checking)
728 def GuardedVar : InheritableAttr {
729 let Spellings = [GNU<"guarded_var">];
732 def PtGuardedVar : InheritableAttr {
733 let Spellings = [GNU<"pt_guarded_var">];
736 def Lockable : InheritableAttr {
737 let Spellings = [GNU<"lockable">];
740 def ScopedLockable : InheritableAttr {
741 let Spellings = [GNU<"scoped_lockable">];
744 def NoThreadSafetyAnalysis : InheritableAttr {
745 let Spellings = [GNU<"no_thread_safety_analysis">];
748 def GuardedBy : InheritableAttr {
749 let Spellings = [GNU<"guarded_by">];
750 let Args = [ExprArgument<"Arg">];
752 let TemplateDependent = 1;
755 def PtGuardedBy : InheritableAttr {
756 let Spellings = [GNU<"pt_guarded_by">];
757 let Args = [ExprArgument<"Arg">];
759 let TemplateDependent = 1;
762 def AcquiredAfter : InheritableAttr {
763 let Spellings = [GNU<"acquired_after">];
764 let Args = [VariadicExprArgument<"Args">];
766 let TemplateDependent = 1;
769 def AcquiredBefore : InheritableAttr {
770 let Spellings = [GNU<"acquired_before">];
771 let Args = [VariadicExprArgument<"Args">];
773 let TemplateDependent = 1;
776 def ExclusiveLockFunction : InheritableAttr {
777 let Spellings = [GNU<"exclusive_lock_function">];
778 let Args = [VariadicExprArgument<"Args">];
780 let TemplateDependent = 1;
783 def SharedLockFunction : InheritableAttr {
784 let Spellings = [GNU<"shared_lock_function">];
785 let Args = [VariadicExprArgument<"Args">];
787 let TemplateDependent = 1;
790 // The first argument is an integer or boolean value specifying the return value
791 // of a successful lock acquisition.
792 def ExclusiveTrylockFunction : InheritableAttr {
793 let Spellings = [GNU<"exclusive_trylock_function">];
794 let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">];
796 let TemplateDependent = 1;
799 // The first argument is an integer or boolean value specifying the return value
800 // of a successful lock acquisition.
801 def SharedTrylockFunction : InheritableAttr {
802 let Spellings = [GNU<"shared_trylock_function">];
803 let Args = [ExprArgument<"SuccessValue">, VariadicExprArgument<"Args">];
805 let TemplateDependent = 1;
808 def UnlockFunction : InheritableAttr {
809 let Spellings = [GNU<"unlock_function">];
810 let Args = [VariadicExprArgument<"Args">];
812 let TemplateDependent = 1;
815 def LockReturned : InheritableAttr {
816 let Spellings = [GNU<"lock_returned">];
817 let Args = [ExprArgument<"Arg">];
819 let TemplateDependent = 1;
822 def LocksExcluded : InheritableAttr {
823 let Spellings = [GNU<"locks_excluded">];
824 let Args = [VariadicExprArgument<"Args">];
826 let TemplateDependent = 1;
829 def ExclusiveLocksRequired : InheritableAttr {
830 let Spellings = [GNU<"exclusive_locks_required">];
831 let Args = [VariadicExprArgument<"Args">];
833 let TemplateDependent = 1;
836 def SharedLocksRequired : InheritableAttr {
837 let Spellings = [GNU<"shared_locks_required">];
838 let Args = [VariadicExprArgument<"Args">];
840 let TemplateDependent = 1;
843 // Type safety attributes for `void *' pointers and type tags.
845 def ArgumentWithTypeTag : InheritableAttr {
846 let Spellings = [GNU<"argument_with_type_tag">,
847 GNU<"pointer_with_type_tag">];
848 let Args = [IdentifierArgument<"ArgumentKind">,
849 UnsignedArgument<"ArgumentIdx">,
850 UnsignedArgument<"TypeTagIdx">,
851 BoolArgument<"IsPointer">];
852 let Subjects = [Function];
855 def TypeTagForDatatype : InheritableAttr {
856 let Spellings = [GNU<"type_tag_for_datatype">];
857 let Args = [IdentifierArgument<"ArgumentKind">,
858 TypeArgument<"MatchingCType">,
859 BoolArgument<"LayoutCompatible">,
860 BoolArgument<"MustBeNull">];
861 let Subjects = [Var];
864 // Microsoft-related attributes
866 def MsStruct : InheritableAttr {
867 let Spellings = [Declspec<"ms_struct">];
870 def DLLExport : InheritableAttr {
871 let Spellings = [Declspec<"dllexport">];
874 def DLLImport : InheritableAttr {
875 let Spellings = [Declspec<"dllimport">];
878 def ForceInline : InheritableAttr {
879 let Spellings = [Declspec<"__forceinline">];
882 def Win64 : InheritableAttr {
883 let Spellings = [Declspec<"w64">];
886 def Ptr32 : InheritableAttr {
887 let Spellings = [Declspec<"__ptr32">];
890 def Ptr64 : InheritableAttr {
891 let Spellings = [Declspec<"__ptr64">];
894 def SingleInheritance : InheritableAttr {
895 let Spellings = [Declspec<"__single_inheritance">];
898 def MultipleInheritance : InheritableAttr {
899 let Spellings = [Declspec<"__multiple_inheritance">];
902 def VirtualInheritance : InheritableAttr {
903 let Spellings = [Declspec<"__virtual_inheritance">];