clang  15.0.0git
ParsedAttr.h
Go to the documentation of this file.
1 //======- ParsedAttr.h - Parsed attribute sets ------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 // This file defines the ParsedAttr class, which is used to collect
10 // parsed attributes.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_SEMA_PARSEDATTR_H
15 #define LLVM_CLANG_SEMA_PARSEDATTR_H
16 
19 #include "clang/Basic/Diagnostic.h"
21 #include "clang/Sema/Ownership.h"
22 #include "llvm/ADT/PointerUnion.h"
23 #include "llvm/ADT/SmallVector.h"
24 #include "llvm/Support/Allocator.h"
25 #include "llvm/Support/Registry.h"
26 #include "llvm/Support/VersionTuple.h"
27 #include <cassert>
28 #include <cstddef>
29 #include <cstring>
30 #include <utility>
31 
32 namespace clang {
33 
34 class ASTContext;
35 class Decl;
36 class Expr;
37 class IdentifierInfo;
38 class LangOptions;
39 class ParsedAttr;
40 class Sema;
41 class Stmt;
42 class TargetInfo;
43 
45  /// Corresponds to the Kind enum.
46  unsigned AttrKind : 16;
47  /// The number of required arguments of this attribute.
48  unsigned NumArgs : 4;
49  /// The number of optional arguments of this attributes.
50  unsigned OptArgs : 4;
51  /// The number of non-fake arguments specified in the attribute definition.
52  unsigned NumArgMembers : 4;
53  /// True if the parsing does not match the semantic content.
54  unsigned HasCustomParsing : 1;
55  // True if this attribute accepts expression parameter pack expansions.
56  unsigned AcceptsExprPack : 1;
57  /// True if this attribute is only available for certain targets.
58  unsigned IsTargetSpecific : 1;
59  /// True if this attribute applies to types.
60  unsigned IsType : 1;
61  /// True if this attribute applies to statements.
62  unsigned IsStmt : 1;
63  /// True if this attribute has any spellings that are known to gcc.
64  unsigned IsKnownToGCC : 1;
65  /// True if this attribute is supported by #pragma clang attribute.
67  /// The syntaxes supported by this attribute and how they're spelled.
68  struct Spelling {
70  const char *NormalizedFullName;
71  };
73  // The names of the known arguments of this attribute.
75 
76 protected:
82 
84  unsigned OptArgs, unsigned NumArgMembers,
85  unsigned HasCustomParsing, unsigned AcceptsExprPack,
86  unsigned IsTargetSpecific, unsigned IsType,
87  unsigned IsStmt, unsigned IsKnownToGCC,
97 
98 public:
99  virtual ~ParsedAttrInfo() = default;
100 
101  /// Check if this attribute appertains to D, and issue a diagnostic if not.
102  virtual bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr,
103  const Decl *D) const {
104  return true;
105  }
106  /// Check if this attribute appertains to St, and issue a diagnostic if not.
107  virtual bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr,
108  const Stmt *St) const {
109  return true;
110  }
111  /// Check if the given attribute is mutually exclusive with other attributes
112  /// already applied to the given declaration.
113  virtual bool diagMutualExclusion(Sema &S, const ParsedAttr &A,
114  const Decl *D) const {
115  return true;
116  }
117  /// Check if this attribute is allowed by the language we are compiling.
118  virtual bool acceptsLangOpts(const LangOptions &LO) const { return true; }
119 
120  /// Check if this attribute is allowed when compiling for the given target.
121  virtual bool existsInTarget(const TargetInfo &Target) const {
122  return true;
123  }
124  /// Convert the spelling index of Attr to a semantic spelling enum value.
125  virtual unsigned
127  return UINT_MAX;
128  }
129  /// Returns true if the specified parameter index for this attribute in
130  /// Attr.td is an ExprArgument or VariadicExprArgument, or a subclass thereof;
131  /// returns false otherwise.
132  virtual bool isParamExpr(size_t N) const { return false; }
133  /// Populate Rules with the match rules of this attribute.
135  llvm::SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &Rules,
136  const LangOptions &LangOpts) const {
137  }
142  };
143  /// If this ParsedAttrInfo knows how to handle this ParsedAttr applied to this
144  /// Decl then do so and return either AttributeApplied if it was applied or
145  /// AttributeNotApplied if it wasn't. Otherwise return NotHandled.
147  const ParsedAttr &Attr) const {
148  return NotHandled;
149  }
150 
151  static const ParsedAttrInfo &get(const AttributeCommonInfo &A);
153 };
154 
155 typedef llvm::Registry<ParsedAttrInfo> ParsedAttrInfoRegistry;
156 
157 /// Represents information about a change in availability for
158 /// an entity, which is part of the encoding of the 'availability'
159 /// attribute.
161  /// The location of the keyword indicating the kind of change.
163 
164  /// The version number at which the change occurred.
165  VersionTuple Version;
166 
167  /// The source range covering the version number.
169 
170  /// Determine whether this availability change is valid.
171  bool isValid() const { return !Version.empty(); }
172 };
173 
174 namespace detail {
177 };
178 
179 /// Describes the trailing object for Availability attribute in ParsedAttr.
184 
186  const AvailabilityChange &Deprecated,
187  const AvailabilityChange &Obsoleted,
188  SourceLocation Strict, const Expr *ReplaceExpr)
189  : StrictLoc(Strict), Replacement(ReplaceExpr) {
190  Changes[IntroducedSlot] = Introduced;
191  Changes[DeprecatedSlot] = Deprecated;
192  Changes[ObsoletedSlot] = Obsoleted;
193  }
194 };
195 
198  unsigned LayoutCompatible : 1;
199  unsigned MustBeNull : 1;
200 };
201 struct PropertyData {
203 
205  : GetterId(getterId), SetterId(setterId) {}
206 };
207 
208 } // namespace
209 
210 /// Wraps an identifier and optional source location for the identifier.
214 
217 };
218 
219 /// A union of the various pointer types that can be passed to an
220 /// ParsedAttr as an argument.
221 using ArgsUnion = llvm::PointerUnion<Expr *, IdentifierLoc *>;
223 
224 /// ParsedAttr - Represents a syntactic attribute.
225 ///
226 /// For a GNU attribute, there are four forms of this construct:
227 ///
228 /// 1: __attribute__(( const )). ParmName/Args/NumArgs will all be unused.
229 /// 2: __attribute__(( mode(byte) )). ParmName used, Args/NumArgs unused.
230 /// 3: __attribute__(( format(printf, 1, 2) )). ParmName/Args/NumArgs all used.
231 /// 4: __attribute__(( aligned(16) )). ParmName is unused, Args/Num used.
232 ///
233 class ParsedAttr final
234  : public AttributeCommonInfo,
235  private llvm::TrailingObjects<
236  ParsedAttr, ArgsUnion, detail::AvailabilityData,
237  detail::TypeTagForDatatypeData, ParsedType, detail::PropertyData> {
238  friend TrailingObjects;
239 
240  size_t numTrailingObjects(OverloadToken<ArgsUnion>) const { return NumArgs; }
241  size_t numTrailingObjects(OverloadToken<detail::AvailabilityData>) const {
242  return IsAvailability;
243  }
244  size_t
245  numTrailingObjects(OverloadToken<detail::TypeTagForDatatypeData>) const {
246  return IsTypeTagForDatatype;
247  }
248  size_t numTrailingObjects(OverloadToken<ParsedType>) const {
249  return HasParsedType;
250  }
251  size_t numTrailingObjects(OverloadToken<detail::PropertyData>) const {
252  return IsProperty;
253  }
254 
255 private:
256  IdentifierInfo *MacroII = nullptr;
257  SourceLocation MacroExpansionLoc;
258  SourceLocation EllipsisLoc;
259 
260  /// The number of expression arguments this attribute has.
261  /// The expressions themselves are stored after the object.
262  unsigned NumArgs : 16;
263 
264  /// True if already diagnosed as invalid.
265  mutable unsigned Invalid : 1;
266 
267  /// True if this attribute was used as a type attribute.
268  mutable unsigned UsedAsTypeAttr : 1;
269 
270  /// True if this has the extra information associated with an
271  /// availability attribute.
272  unsigned IsAvailability : 1;
273 
274  /// True if this has extra information associated with a
275  /// type_tag_for_datatype attribute.
276  unsigned IsTypeTagForDatatype : 1;
277 
278  /// True if this has extra information associated with a
279  /// Microsoft __delcspec(property) attribute.
280  unsigned IsProperty : 1;
281 
282  /// True if this has a ParsedType
283  unsigned HasParsedType : 1;
284 
285  /// True if the processing cache is valid.
286  mutable unsigned HasProcessingCache : 1;
287 
288  /// A cached value.
289  mutable unsigned ProcessingCache : 8;
290 
291  /// True if the attribute is specified using '#pragma clang attribute'.
292  mutable unsigned IsPragmaClangAttribute : 1;
293 
294  /// The location of the 'unavailable' keyword in an
295  /// availability attribute.
296  SourceLocation UnavailableLoc;
297 
298  const Expr *MessageExpr;
299 
300  const ParsedAttrInfo &Info;
301 
302  ArgsUnion *getArgsBuffer() { return getTrailingObjects<ArgsUnion>(); }
303  ArgsUnion const *getArgsBuffer() const {
304  return getTrailingObjects<ArgsUnion>();
305  }
306 
307  detail::AvailabilityData *getAvailabilityData() {
308  return getTrailingObjects<detail::AvailabilityData>();
309  }
310  const detail::AvailabilityData *getAvailabilityData() const {
311  return getTrailingObjects<detail::AvailabilityData>();
312  }
313 
314 private:
315  friend class AttributeFactory;
316  friend class AttributePool;
317 
318  /// Constructor for attributes with expression arguments.
319  ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
320  IdentifierInfo *scopeName, SourceLocation scopeLoc,
321  ArgsUnion *args, unsigned numArgs, Syntax syntaxUsed,
322  SourceLocation ellipsisLoc)
323  : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
324  syntaxUsed),
325  EllipsisLoc(ellipsisLoc), NumArgs(numArgs), Invalid(false),
326  UsedAsTypeAttr(false), IsAvailability(false),
327  IsTypeTagForDatatype(false), IsProperty(false), HasParsedType(false),
328  HasProcessingCache(false), IsPragmaClangAttribute(false),
329  Info(ParsedAttrInfo::get(*this)) {
330  if (numArgs)
331  memcpy(getArgsBuffer(), args, numArgs * sizeof(ArgsUnion));
332  }
333 
334  /// Constructor for availability attributes.
335  ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
336  IdentifierInfo *scopeName, SourceLocation scopeLoc,
337  IdentifierLoc *Parm, const AvailabilityChange &introduced,
338  const AvailabilityChange &deprecated,
339  const AvailabilityChange &obsoleted, SourceLocation unavailable,
340  const Expr *messageExpr, Syntax syntaxUsed, SourceLocation strict,
341  const Expr *replacementExpr)
342  : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
343  syntaxUsed),
344  NumArgs(1), Invalid(false), UsedAsTypeAttr(false), IsAvailability(true),
345  IsTypeTagForDatatype(false), IsProperty(false), HasParsedType(false),
346  HasProcessingCache(false), IsPragmaClangAttribute(false),
347  UnavailableLoc(unavailable), MessageExpr(messageExpr),
348  Info(ParsedAttrInfo::get(*this)) {
349  ArgsUnion PVal(Parm);
350  memcpy(getArgsBuffer(), &PVal, sizeof(ArgsUnion));
351  new (getAvailabilityData()) detail::AvailabilityData(
352  introduced, deprecated, obsoleted, strict, replacementExpr);
353  }
354 
355  /// Constructor for objc_bridge_related attributes.
356  ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
357  IdentifierInfo *scopeName, SourceLocation scopeLoc,
358  IdentifierLoc *Parm1, IdentifierLoc *Parm2, IdentifierLoc *Parm3,
359  Syntax syntaxUsed)
360  : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
361  syntaxUsed),
362  NumArgs(3), Invalid(false), UsedAsTypeAttr(false),
363  IsAvailability(false), IsTypeTagForDatatype(false), IsProperty(false),
364  HasParsedType(false), HasProcessingCache(false),
365  IsPragmaClangAttribute(false), Info(ParsedAttrInfo::get(*this)) {
366  ArgsUnion *Args = getArgsBuffer();
367  Args[0] = Parm1;
368  Args[1] = Parm2;
369  Args[2] = Parm3;
370  }
371 
372  /// Constructor for type_tag_for_datatype attribute.
373  ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
374  IdentifierInfo *scopeName, SourceLocation scopeLoc,
375  IdentifierLoc *ArgKind, ParsedType matchingCType,
376  bool layoutCompatible, bool mustBeNull, Syntax syntaxUsed)
377  : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
378  syntaxUsed),
379  NumArgs(1), Invalid(false), UsedAsTypeAttr(false),
380  IsAvailability(false), IsTypeTagForDatatype(true), IsProperty(false),
381  HasParsedType(false), HasProcessingCache(false),
382  IsPragmaClangAttribute(false), Info(ParsedAttrInfo::get(*this)) {
383  ArgsUnion PVal(ArgKind);
384  memcpy(getArgsBuffer(), &PVal, sizeof(ArgsUnion));
385  detail::TypeTagForDatatypeData &ExtraData = getTypeTagForDatatypeDataSlot();
386  new (&ExtraData.MatchingCType) ParsedType(matchingCType);
387  ExtraData.LayoutCompatible = layoutCompatible;
388  ExtraData.MustBeNull = mustBeNull;
389  }
390 
391  /// Constructor for attributes with a single type argument.
392  ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
393  IdentifierInfo *scopeName, SourceLocation scopeLoc,
394  ParsedType typeArg, Syntax syntaxUsed)
395  : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
396  syntaxUsed),
397  NumArgs(0), Invalid(false), UsedAsTypeAttr(false),
398  IsAvailability(false), IsTypeTagForDatatype(false), IsProperty(false),
399  HasParsedType(true), HasProcessingCache(false),
400  IsPragmaClangAttribute(false), Info(ParsedAttrInfo::get(*this)) {
401  new (&getTypeBuffer()) ParsedType(typeArg);
402  }
403 
404  /// Constructor for microsoft __declspec(property) attribute.
405  ParsedAttr(IdentifierInfo *attrName, SourceRange attrRange,
406  IdentifierInfo *scopeName, SourceLocation scopeLoc,
407  IdentifierInfo *getterId, IdentifierInfo *setterId,
408  Syntax syntaxUsed)
409  : AttributeCommonInfo(attrName, scopeName, attrRange, scopeLoc,
410  syntaxUsed),
411  NumArgs(0), Invalid(false), UsedAsTypeAttr(false),
412  IsAvailability(false), IsTypeTagForDatatype(false), IsProperty(true),
413  HasParsedType(false), HasProcessingCache(false),
414  IsPragmaClangAttribute(false), Info(ParsedAttrInfo::get(*this)) {
415  new (&getPropertyDataBuffer()) detail::PropertyData(getterId, setterId);
416  }
417 
418  /// Type tag information is stored immediately following the arguments, if
419  /// any, at the end of the object. They are mutually exclusive with
420  /// availability slots.
421  detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot() {
422  return *getTrailingObjects<detail::TypeTagForDatatypeData>();
423  }
424  const detail::TypeTagForDatatypeData &getTypeTagForDatatypeDataSlot() const {
425  return *getTrailingObjects<detail::TypeTagForDatatypeData>();
426  }
427 
428  /// The type buffer immediately follows the object and are mutually exclusive
429  /// with arguments.
430  ParsedType &getTypeBuffer() { return *getTrailingObjects<ParsedType>(); }
431  const ParsedType &getTypeBuffer() const {
432  return *getTrailingObjects<ParsedType>();
433  }
434 
435  /// The property data immediately follows the object is is mutually exclusive
436  /// with arguments.
437  detail::PropertyData &getPropertyDataBuffer() {
438  assert(IsProperty);
439  return *getTrailingObjects<detail::PropertyData>();
440  }
441  const detail::PropertyData &getPropertyDataBuffer() const {
442  assert(IsProperty);
443  return *getTrailingObjects<detail::PropertyData>();
444  }
445 
446  size_t allocated_size() const;
447 
448 public:
449  ParsedAttr(const ParsedAttr &) = delete;
450  ParsedAttr(ParsedAttr &&) = delete;
451  ParsedAttr &operator=(const ParsedAttr &) = delete;
452  ParsedAttr &operator=(ParsedAttr &&) = delete;
453  ~ParsedAttr() = delete;
454 
455  void operator delete(void *) = delete;
456 
457  bool hasParsedType() const { return HasParsedType; }
458 
459  /// Is this the Microsoft __declspec(property) attribute?
461  return IsProperty;
462  }
463 
464  bool isInvalid() const { return Invalid; }
465  void setInvalid(bool b = true) const { Invalid = b; }
466 
467  bool hasProcessingCache() const { return HasProcessingCache; }
468 
469  unsigned getProcessingCache() const {
470  assert(hasProcessingCache());
471  return ProcessingCache;
472  }
473 
474  void setProcessingCache(unsigned value) const {
475  ProcessingCache = value;
476  HasProcessingCache = true;
477  }
478 
479  bool isUsedAsTypeAttr() const { return UsedAsTypeAttr; }
480  void setUsedAsTypeAttr(bool Used = true) { UsedAsTypeAttr = Used; }
481 
482  /// True if the attribute is specified using '#pragma clang attribute'.
483  bool isPragmaClangAttribute() const { return IsPragmaClangAttribute; }
484 
485  void setIsPragmaClangAttribute() { IsPragmaClangAttribute = true; }
486 
487  bool isPackExpansion() const { return EllipsisLoc.isValid(); }
488  SourceLocation getEllipsisLoc() const { return EllipsisLoc; }
489 
490  /// getNumArgs - Return the number of actual arguments to this attribute.
491  unsigned getNumArgs() const { return NumArgs; }
492 
493  /// getArg - Return the specified argument.
494  ArgsUnion getArg(unsigned Arg) const {
495  assert(Arg < NumArgs && "Arg access out of range!");
496  return getArgsBuffer()[Arg];
497  }
498 
499  bool isArgExpr(unsigned Arg) const {
500  return Arg < NumArgs && getArg(Arg).is<Expr*>();
501  }
502 
503  Expr *getArgAsExpr(unsigned Arg) const {
504  return getArg(Arg).get<Expr*>();
505  }
506 
507  bool isArgIdent(unsigned Arg) const {
508  return Arg < NumArgs && getArg(Arg).is<IdentifierLoc*>();
509  }
510 
511  IdentifierLoc *getArgAsIdent(unsigned Arg) const {
512  return getArg(Arg).get<IdentifierLoc*>();
513  }
514 
516  assert(getParsedKind() == AT_Availability &&
517  "Not an availability attribute");
518  return getAvailabilityData()->Changes[detail::IntroducedSlot];
519  }
520 
522  assert(getParsedKind() == AT_Availability &&
523  "Not an availability attribute");
524  return getAvailabilityData()->Changes[detail::DeprecatedSlot];
525  }
526 
528  assert(getParsedKind() == AT_Availability &&
529  "Not an availability attribute");
530  return getAvailabilityData()->Changes[detail::ObsoletedSlot];
531  }
532 
534  assert(getParsedKind() == AT_Availability &&
535  "Not an availability attribute");
536  return getAvailabilityData()->StrictLoc;
537  }
538 
540  assert(getParsedKind() == AT_Availability &&
541  "Not an availability attribute");
542  return UnavailableLoc;
543  }
544 
545  const Expr * getMessageExpr() const {
546  assert(getParsedKind() == AT_Availability &&
547  "Not an availability attribute");
548  return MessageExpr;
549  }
550 
551  const Expr *getReplacementExpr() const {
552  assert(getParsedKind() == AT_Availability &&
553  "Not an availability attribute");
554  return getAvailabilityData()->Replacement;
555  }
556 
557  const ParsedType &getMatchingCType() const {
558  assert(getParsedKind() == AT_TypeTagForDatatype &&
559  "Not a type_tag_for_datatype attribute");
560  return getTypeTagForDatatypeDataSlot().MatchingCType;
561  }
562 
563  bool getLayoutCompatible() const {
564  assert(getParsedKind() == AT_TypeTagForDatatype &&
565  "Not a type_tag_for_datatype attribute");
566  return getTypeTagForDatatypeDataSlot().LayoutCompatible;
567  }
568 
569  bool getMustBeNull() const {
570  assert(getParsedKind() == AT_TypeTagForDatatype &&
571  "Not a type_tag_for_datatype attribute");
572  return getTypeTagForDatatypeDataSlot().MustBeNull;
573  }
574 
575  const ParsedType &getTypeArg() const {
576  assert(HasParsedType && "Not a type attribute");
577  return getTypeBuffer();
578  }
579 
581  assert(isDeclspecPropertyAttribute() &&
582  "Not a __delcspec(property) attribute");
583  return getPropertyDataBuffer().GetterId;
584  }
585 
587  assert(isDeclspecPropertyAttribute() &&
588  "Not a __delcspec(property) attribute");
589  return getPropertyDataBuffer().SetterId;
590  }
591 
592  /// Set the macro identifier info object that this parsed attribute was
593  /// declared in if it was declared in a macro. Also set the expansion location
594  /// of the macro.
596  MacroII = MacroName;
597  MacroExpansionLoc = Loc;
598  }
599 
600  /// Returns true if this attribute was declared in a macro.
601  bool hasMacroIdentifier() const { return MacroII != nullptr; }
602 
603  /// Return the macro identifier if this attribute was declared in a macro.
604  /// nullptr is returned if it was not declared in a macro.
605  IdentifierInfo *getMacroIdentifier() const { return MacroII; }
606 
608  assert(hasMacroIdentifier() && "Can only get the macro expansion location "
609  "if this attribute has a macro identifier.");
610  return MacroExpansionLoc;
611  }
612 
613  /// Check if the attribute has exactly as many args as Num. May output an
614  /// error. Returns false if a diagnostic is produced.
615  bool checkExactlyNumArgs(class Sema &S, unsigned Num) const;
616  /// Check if the attribute has at least as many args as Num. May output an
617  /// error. Returns false if a diagnostic is produced.
618  bool checkAtLeastNumArgs(class Sema &S, unsigned Num) const;
619  /// Check if the attribute has at most as many args as Num. May output an
620  /// error. Returns false if a diagnostic is produced.
621  bool checkAtMostNumArgs(class Sema &S, unsigned Num) const;
622 
623  bool isTargetSpecificAttr() const;
624  bool isTypeAttr() const;
625  bool isStmtAttr() const;
626 
627  bool hasCustomParsing() const;
628  bool acceptsExprPack() const;
629  bool isParamExpr(size_t N) const;
630  unsigned getMinArgs() const;
631  unsigned getMaxArgs() const;
632  unsigned getNumArgMembers() const;
633  bool hasVariadicArg() const;
634  void handleAttrWithDelayedArgs(Sema &S, Decl *D) const;
635  bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const;
636  bool diagnoseAppertainsTo(class Sema &S, const Stmt *St) const;
637  bool diagnoseMutualExclusion(class Sema &S, const Decl *D) const;
638  // This function stub exists for parity with the declaration checking code so
639  // that checkCommonAttributeFeatures() can work generically on declarations
640  // or statements.
641  bool diagnoseMutualExclusion(class Sema &S, const Stmt *St) const {
642  return true;
643  }
644  bool appliesToDecl(const Decl *D, attr::SubjectMatchRule MatchRule) const;
645  void getMatchRules(const LangOptions &LangOpts,
646  SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>>
647  &MatchRules) const;
648  bool diagnoseLangOpts(class Sema &S) const;
649  bool existsInTarget(const TargetInfo &Target) const;
650  bool isKnownToGCC() const;
651  bool isSupportedByPragmaAttribute() const;
652 
653  /// Returns whether a [[]] attribute, if specified ahead of a declaration,
654  /// should be applied to the decl-specifier-seq instead (i.e. whether it
655  /// "slides" to the decl-specifier-seq).
656  ///
657  /// By the standard, attributes specified before the declaration always
658  /// appertain to the declaration, but historically we have allowed some of
659  /// these attributes to slide to the decl-specifier-seq, so we need to keep
660  /// supporting this behavior.
661  ///
662  /// This may only be called if isStandardAttributeSyntax() returns true.
664 
665  /// If the parsed attribute has a semantic equivalent, and it would
666  /// have a semantic Spelling enumeration (due to having semantically-distinct
667  /// spelling variations), return the value of that semantic spelling. If the
668  /// parsed attribute does not have a semantic equivalent, or would not have
669  /// a Spelling enumeration, the value UINT_MAX is returned.
670  unsigned getSemanticSpelling() const;
671 
672  /// If this is an OpenCL address space attribute, returns its representation
673  /// in LangAS, otherwise returns default address space.
675  switch (getParsedKind()) {
676  case ParsedAttr::AT_OpenCLConstantAddressSpace:
678  case ParsedAttr::AT_OpenCLGlobalAddressSpace:
679  return LangAS::opencl_global;
680  case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
682  case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
684  case ParsedAttr::AT_OpenCLLocalAddressSpace:
685  return LangAS::opencl_local;
686  case ParsedAttr::AT_OpenCLPrivateAddressSpace:
687  return LangAS::opencl_private;
688  case ParsedAttr::AT_OpenCLGenericAddressSpace:
689  return LangAS::opencl_generic;
690  default:
691  return LangAS::Default;
692  }
693  }
694 
695  /// If this is an OpenCL address space attribute, returns its SYCL
696  /// representation in LangAS, otherwise returns default address space.
698  switch (getKind()) {
699  case ParsedAttr::AT_OpenCLGlobalAddressSpace:
700  return LangAS::sycl_global;
701  case ParsedAttr::AT_OpenCLGlobalDeviceAddressSpace:
703  case ParsedAttr::AT_OpenCLGlobalHostAddressSpace:
705  case ParsedAttr::AT_OpenCLLocalAddressSpace:
706  return LangAS::sycl_local;
707  case ParsedAttr::AT_OpenCLPrivateAddressSpace:
708  return LangAS::sycl_private;
709  case ParsedAttr::AT_OpenCLGenericAddressSpace:
710  default:
711  return LangAS::Default;
712  }
713  }
714 
716  return AttributeCommonInfo::Kind(Info.AttrKind);
717  }
718  const ParsedAttrInfo &getInfo() const { return Info; }
719 };
720 
721 class AttributePool;
722 /// A factory, from which one makes pools, from which one creates
723 /// individual attributes which are deallocated with the pool.
724 ///
725 /// Note that it's tolerably cheap to create and destroy one of
726 /// these as long as you don't actually allocate anything in it.
728 public:
729  enum {
731  ParsedAttr::totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
733  detail::PropertyData>(1, 1, 0, 0, 0),
735  ParsedAttr::totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
737  detail::PropertyData>(1, 0, 1, 0, 0),
739  ParsedAttr::totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
741  detail::PropertyData>(0, 0, 0, 0, 1),
742  };
743 
744 private:
745  enum {
746  /// The number of free lists we want to be sure to support
747  /// inline. This is just enough that availability attributes
748  /// don't surpass it. It's actually very unlikely we'll see an
749  /// attribute that needs more than that; on x86-64 you'd need 10
750  /// expression arguments, and on i386 you'd need 19.
751  InlineFreeListsCapacity =
752  1 + (AvailabilityAllocSize - sizeof(ParsedAttr)) / sizeof(void *)
753  };
754 
755  llvm::BumpPtrAllocator Alloc;
756 
757  /// Free lists. The index is determined by the following formula:
758  /// (size - sizeof(ParsedAttr)) / sizeof(void*)
759  SmallVector<SmallVector<ParsedAttr *, 8>, InlineFreeListsCapacity> FreeLists;
760 
761  // The following are the private interface used by AttributePool.
762  friend class AttributePool;
763 
764  /// Allocate an attribute of the given size.
765  void *allocate(size_t size);
766 
767  void deallocate(ParsedAttr *AL);
768 
769  /// Reclaim all the attributes in the given pool chain, which is
770  /// non-empty. Note that the current implementation is safe
771  /// against reclaiming things which were not actually allocated
772  /// with the allocator, although of course it's important to make
773  /// sure that their allocator lives at least as long as this one.
774  void reclaimPool(AttributePool &head);
775 
776 public:
779 };
780 
782  friend class AttributeFactory;
783  friend class ParsedAttributes;
784  AttributeFactory &Factory;
786 
787  void *allocate(size_t size) {
788  return Factory.allocate(size);
789  }
790 
791  ParsedAttr *add(ParsedAttr *attr) {
792  Attrs.push_back(attr);
793  return attr;
794  }
795 
796  void remove(ParsedAttr *attr) {
797  assert(llvm::is_contained(Attrs, attr) &&
798  "Can't take attribute from a pool that doesn't own it!");
799  Attrs.erase(llvm::find(Attrs, attr));
800  }
801 
802  void takePool(AttributePool &pool);
803 
804 public:
805  /// Create a new pool for a factory.
806  AttributePool(AttributeFactory &factory) : Factory(factory) {}
807 
808  AttributePool(const AttributePool &) = delete;
809 
810  ~AttributePool() { Factory.reclaimPool(*this); }
811 
812  /// Move the given pool's allocations to this pool.
813  AttributePool(AttributePool &&pool) = default;
814 
815  AttributeFactory &getFactory() const { return Factory; }
816 
817  void clear() {
818  Factory.reclaimPool(*this);
819  Attrs.clear();
820  }
821 
822  /// Take the given pool's allocations and add them to this pool.
824  takePool(pool);
825  pool.Attrs.clear();
826  }
827 
829  IdentifierInfo *scopeName, SourceLocation scopeLoc,
830  ArgsUnion *args, unsigned numArgs,
831  ParsedAttr::Syntax syntax,
832  SourceLocation ellipsisLoc = SourceLocation()) {
833  size_t temp =
834  ParsedAttr::totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
836  detail::PropertyData>(numArgs, 0, 0, 0, 0);
837  (void)temp;
838  void *memory = allocate(
839  ParsedAttr::totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
841  detail::PropertyData>(numArgs, 0, 0, 0,
842  0));
843  return add(new (memory) ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
844  args, numArgs, syntax, ellipsisLoc));
845  }
846 
848  IdentifierInfo *scopeName, SourceLocation scopeLoc,
849  IdentifierLoc *Param, const AvailabilityChange &introduced,
850  const AvailabilityChange &deprecated,
851  const AvailabilityChange &obsoleted,
852  SourceLocation unavailable, const Expr *MessageExpr,
853  ParsedAttr::Syntax syntax, SourceLocation strict,
854  const Expr *ReplacementExpr) {
855  void *memory = allocate(AttributeFactory::AvailabilityAllocSize);
856  return add(new (memory) ParsedAttr(
857  attrName, attrRange, scopeName, scopeLoc, Param, introduced, deprecated,
858  obsoleted, unavailable, MessageExpr, syntax, strict, ReplacementExpr));
859  }
860 
862  IdentifierInfo *scopeName, SourceLocation scopeLoc,
863  IdentifierLoc *Param1, IdentifierLoc *Param2,
864  IdentifierLoc *Param3, ParsedAttr::Syntax syntax) {
865  void *memory = allocate(
866  ParsedAttr::totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
868  detail::PropertyData>(3, 0, 0, 0, 0));
869  return add(new (memory) ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
870  Param1, Param2, Param3, syntax));
871  }
872 
873  ParsedAttr *
875  IdentifierInfo *scopeName, SourceLocation scopeLoc,
876  IdentifierLoc *argumentKind,
877  ParsedType matchingCType, bool layoutCompatible,
878  bool mustBeNull, ParsedAttr::Syntax syntax) {
879  void *memory = allocate(AttributeFactory::TypeTagForDatatypeAllocSize);
880  return add(new (memory) ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
881  argumentKind, matchingCType,
882  layoutCompatible, mustBeNull, syntax));
883  }
884 
886  SourceRange attrRange,
887  IdentifierInfo *scopeName,
888  SourceLocation scopeLoc, ParsedType typeArg,
889  ParsedAttr::Syntax syntaxUsed) {
890  void *memory = allocate(
891  ParsedAttr::totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
893  detail::PropertyData>(0, 0, 0, 1, 0));
894  return add(new (memory) ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
895  typeArg, syntaxUsed));
896  }
897 
898  ParsedAttr *
900  IdentifierInfo *scopeName, SourceLocation scopeLoc,
901  IdentifierInfo *getterId, IdentifierInfo *setterId,
902  ParsedAttr::Syntax syntaxUsed) {
903  void *memory = allocate(AttributeFactory::PropertyAllocSize);
904  return add(new (memory) ParsedAttr(attrName, attrRange, scopeName, scopeLoc,
905  getterId, setterId, syntaxUsed));
906  }
907 };
908 
911  using SizeType = decltype(std::declval<VecTy>().size());
912 
913 public:
915 
916  static const ParsedAttributesView &none() {
917  static const ParsedAttributesView Attrs;
918  return Attrs;
919  }
920 
921  bool empty() const { return AttrList.empty(); }
922  SizeType size() const { return AttrList.size(); }
923  ParsedAttr &operator[](SizeType pos) { return *AttrList[pos]; }
924  const ParsedAttr &operator[](SizeType pos) const { return *AttrList[pos]; }
925 
926  void addAtEnd(ParsedAttr *newAttr) {
927  assert(newAttr);
928  AttrList.push_back(newAttr);
929  }
930 
931  void remove(ParsedAttr *ToBeRemoved) {
932  assert(is_contained(AttrList, ToBeRemoved) &&
933  "Cannot remove attribute that isn't in the list");
934  AttrList.erase(llvm::find(AttrList, ToBeRemoved));
935  }
936 
937  void clearListOnly() { AttrList.clear(); }
938 
939  struct iterator : llvm::iterator_adaptor_base<iterator, VecTy::iterator,
940  std::random_access_iterator_tag,
941  ParsedAttr> {
942  iterator() : iterator_adaptor_base(nullptr) {}
943  iterator(VecTy::iterator I) : iterator_adaptor_base(I) {}
944  reference operator*() const { return **I; }
945  friend class ParsedAttributesView;
946  };
948  : llvm::iterator_adaptor_base<const_iterator, VecTy::const_iterator,
949  std::random_access_iterator_tag,
950  ParsedAttr> {
951  const_iterator() : iterator_adaptor_base(nullptr) {}
952  const_iterator(VecTy::const_iterator I) : iterator_adaptor_base(I) {}
953 
954  reference operator*() const { return **I; }
955  friend class ParsedAttributesView;
956  };
957 
958  void addAll(iterator B, iterator E) {
959  AttrList.insert(AttrList.begin(), B.I, E.I);
960  }
961 
963  AttrList.insert(AttrList.begin(), B.I, E.I);
964  }
965 
967  AttrList.insert(AttrList.end(), B.I, E.I);
968  }
969 
971  AttrList.insert(AttrList.end(), B.I, E.I);
972  }
973 
974  iterator begin() { return iterator(AttrList.begin()); }
975  const_iterator begin() const { return const_iterator(AttrList.begin()); }
976  iterator end() { return iterator(AttrList.end()); }
977  const_iterator end() const { return const_iterator(AttrList.end()); }
978 
980  assert(!empty());
981  return *AttrList.front();
982  }
983  const ParsedAttr &front() const {
984  assert(!empty());
985  return *AttrList.front();
986  }
988  assert(!empty());
989  return *AttrList.back();
990  }
991  const ParsedAttr &back() const {
992  assert(!empty());
993  return *AttrList.back();
994  }
995 
997  return llvm::any_of(AttrList, [K](const ParsedAttr *AL) {
998  return AL->getParsedKind() == K;
999  });
1000  }
1001 
1002 private:
1003  VecTy AttrList;
1004 };
1005 
1006 /// ParsedAttributes - A collection of parsed attributes. Currently
1007 /// we don't differentiate between the various attribute syntaxes,
1008 /// which is basically silly.
1009 ///
1010 /// Right now this is a very lightweight container, but the expectation
1011 /// is that this will become significantly more serious.
1013 public:
1014  ParsedAttributes(AttributeFactory &factory) : pool(factory) {}
1015  ParsedAttributes(const ParsedAttributes &) = delete;
1016 
1017  AttributePool &getPool() const { return pool; }
1018 
1020  assert(&Other != this &&
1021  "ParsedAttributes can't take attributes from itself");
1022  addAll(Other.begin(), Other.end());
1023  Other.clearListOnly();
1024  pool.takeAllFrom(Other.pool);
1025  }
1026 
1028  assert(&Other != this &&
1029  "ParsedAttributes can't take attribute from itself");
1030  Other.getPool().remove(PA);
1031  Other.remove(PA);
1032  getPool().add(PA);
1033  addAtEnd(PA);
1034  }
1035 
1036  void clear() {
1037  clearListOnly();
1038  pool.clear();
1039  Range = SourceRange();
1040  }
1041 
1042  /// Add attribute with expression arguments.
1044  IdentifierInfo *scopeName, SourceLocation scopeLoc,
1045  ArgsUnion *args, unsigned numArgs,
1046  ParsedAttr::Syntax syntax,
1047  SourceLocation ellipsisLoc = SourceLocation()) {
1048  ParsedAttr *attr = pool.create(attrName, attrRange, scopeName, scopeLoc,
1049  args, numArgs, syntax, ellipsisLoc);
1050  addAtEnd(attr);
1051  return attr;
1052  }
1053 
1054  /// Add availability attribute.
1056  IdentifierInfo *scopeName, SourceLocation scopeLoc,
1057  IdentifierLoc *Param, const AvailabilityChange &introduced,
1058  const AvailabilityChange &deprecated,
1059  const AvailabilityChange &obsoleted,
1060  SourceLocation unavailable, const Expr *MessageExpr,
1061  ParsedAttr::Syntax syntax, SourceLocation strict,
1062  const Expr *ReplacementExpr) {
1063  ParsedAttr *attr = pool.create(
1064  attrName, attrRange, scopeName, scopeLoc, Param, introduced, deprecated,
1065  obsoleted, unavailable, MessageExpr, syntax, strict, ReplacementExpr);
1066  addAtEnd(attr);
1067  return attr;
1068  }
1069 
1070  /// Add objc_bridge_related attribute.
1072  IdentifierInfo *scopeName, SourceLocation scopeLoc,
1073  IdentifierLoc *Param1, IdentifierLoc *Param2,
1074  IdentifierLoc *Param3, ParsedAttr::Syntax syntax) {
1075  ParsedAttr *attr = pool.create(attrName, attrRange, scopeName, scopeLoc,
1076  Param1, Param2, Param3, syntax);
1077  addAtEnd(attr);
1078  return attr;
1079  }
1080 
1081  /// Add type_tag_for_datatype attribute.
1082  ParsedAttr *
1084  IdentifierInfo *scopeName, SourceLocation scopeLoc,
1085  IdentifierLoc *argumentKind,
1086  ParsedType matchingCType, bool layoutCompatible,
1087  bool mustBeNull, ParsedAttr::Syntax syntax) {
1089  attrName, attrRange, scopeName, scopeLoc, argumentKind, matchingCType,
1090  layoutCompatible, mustBeNull, syntax);
1091  addAtEnd(attr);
1092  return attr;
1093  }
1094 
1095  /// Add an attribute with a single type argument.
1097  IdentifierInfo *scopeName, SourceLocation scopeLoc,
1098  ParsedType typeArg,
1099  ParsedAttr::Syntax syntaxUsed) {
1100  ParsedAttr *attr = pool.createTypeAttribute(attrName, attrRange, scopeName,
1101  scopeLoc, typeArg, syntaxUsed);
1102  addAtEnd(attr);
1103  return attr;
1104  }
1105 
1106  /// Add microsoft __delspec(property) attribute.
1107  ParsedAttr *
1109  IdentifierInfo *scopeName, SourceLocation scopeLoc,
1110  IdentifierInfo *getterId, IdentifierInfo *setterId,
1111  ParsedAttr::Syntax syntaxUsed) {
1112  ParsedAttr *attr =
1113  pool.createPropertyAttribute(attrName, attrRange, scopeName, scopeLoc,
1114  getterId, setterId, syntaxUsed);
1115  addAtEnd(attr);
1116  return attr;
1117  }
1118 
1119 private:
1120  mutable AttributePool pool;
1121 };
1122 
1123 /// Consumes the attributes from `First` and `Second` and concatenates them into
1124 /// `Result`. Sets `Result.Range` to the combined range of `First` and `Second`.
1125 void takeAndConcatenateAttrs(ParsedAttributes &First, ParsedAttributes &Second,
1126  ParsedAttributes &Result);
1127 
1128 /// These constants match the enumerated choices of
1129 /// err_attribute_argument_n_type and err_attribute_argument_type.
1137 };
1138 
1139 /// These constants match the enumerated choices of
1140 /// warn_attribute_wrong_decl_type and err_attribute_wrong_decl_type.
1155 };
1156 
1158  const ParsedAttr &At) {
1159  DB.AddTaggedVal(reinterpret_cast<uint64_t>(At.getAttrName()),
1161  return DB;
1162 }
1163 
1165  const ParsedAttr *At) {
1166  DB.AddTaggedVal(reinterpret_cast<uint64_t>(At->getAttrName()),
1168  return DB;
1169 }
1170 
1171 /// AttributeCommonInfo has a non-explicit constructor which takes an
1172 /// SourceRange as its only argument, this constructor has many uses so making
1173 /// it explicit is hard. This constructor causes ambiguity with
1174 /// DiagnosticBuilder &operator<<(const DiagnosticBuilder &DB, SourceRange R).
1175 /// We use SFINAE to disable any conversion and remove any ambiguity.
1176 template <typename ACI,
1177  typename std::enable_if_t<
1178  std::is_same<ACI, AttributeCommonInfo>::value, int> = 0>
1180  const ACI &CI) {
1181  DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI.getAttrName()),
1183  return DB;
1184 }
1185 
1186 template <typename ACI,
1187  typename std::enable_if_t<
1188  std::is_same<ACI, AttributeCommonInfo>::value, int> = 0>
1190  const ACI* CI) {
1191  DB.AddTaggedVal(reinterpret_cast<uint64_t>(CI->getAttrName()),
1193  return DB;
1194 }
1195 
1196 } // namespace clang
1197 
1198 #endif // LLVM_CLANG_SEMA_PARSEDATTR_H
clang::AttributeCommonInfo::getParsedKind
Kind getParsedKind() const
Definition: AttributeCommonInfo.h:129
clang::ParsedAttrInfo::AttributeApplied
@ AttributeApplied
Definition: ParsedAttr.h:140
clang::ParsedAttr::getAvailabilityDeprecated
const AvailabilityChange & getAvailabilityDeprecated() const
Definition: ParsedAttr.h:521
clang::ParsedAttr::getMinArgs
unsigned getMinArgs() const
Definition: ParsedAttr.cpp:152
clang::ParsedAttributes::takeOneFrom
void takeOneFrom(ParsedAttributes &Other, ParsedAttr *PA)
Definition: ParsedAttr.h:1027
clang::LangAS::opencl_private
@ opencl_private
clang::ParsedAttr::getMessageExpr
const Expr * getMessageExpr() const
Definition: ParsedAttr.h:545
clang::AttributePool::createPropertyAttribute
ParsedAttr * createPropertyAttribute(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Syntax syntaxUsed)
Definition: ParsedAttr.h:899
clang::detail::PropertyData::PropertyData
PropertyData(IdentifierInfo *getterId, IdentifierInfo *setterId)
Definition: ParsedAttr.h:204
clang::ParsedAttrInfo::ArgNames
ArrayRef< const char * > ArgNames
Definition: ParsedAttr.h:74
clang::IdentifierLoc::Ident
IdentifierInfo * Ident
Definition: ParsedAttr.h:213
clang::AttributePool::getFactory
AttributeFactory & getFactory() const
Definition: ParsedAttr.h:815
clang::LangAS::sycl_global
@ sycl_global
clang::AvailabilityChange::KeywordLoc
SourceLocation KeywordLoc
The location of the keyword indicating the kind of change.
Definition: ParsedAttr.h:162
clang::ParsedAttr::getNumArgMembers
unsigned getNumArgMembers() const
Definition: ParsedAttr.cpp:158
clang::ParsedAttr::isUsedAsTypeAttr
bool isUsedAsTypeAttr() const
Definition: ParsedAttr.h:479
clang::AttributeCommonInfo::Kind
Kind
Definition: AttributeCommonInfo.h:55
clang::ParsedAttrInfo::IsTargetSpecific
unsigned IsTargetSpecific
True if this attribute is only available for certain targets.
Definition: ParsedAttr.h:58
clang::ParsedAttr::getKind
AttributeCommonInfo::Kind getKind() const
Definition: ParsedAttr.h:715
clang::ParsedAttributesView::begin
const_iterator begin() const
Definition: ParsedAttr.h:975
clang::ExpectedVariable
@ ExpectedVariable
Definition: ParsedAttr.h:1148
clang::ParsedAttr::getEllipsisLoc
SourceLocation getEllipsisLoc() const
Definition: ParsedAttr.h:488
AttributeCommonInfo.h
clang::SourceRange
A trivial tuple used to represent a source range.
Definition: SourceLocation.h:210
clang::ParsedAttributesView::none
static const ParsedAttributesView & none()
Definition: ParsedAttr.h:916
clang::ExpectedVariableOrFunction
@ ExpectedVariableOrFunction
Definition: ParsedAttr.h:1144
clang::ParsedAttr::isDeclspecPropertyAttribute
bool isDeclspecPropertyAttribute() const
Is this the Microsoft __declspec(property) attribute?
Definition: ParsedAttr.h:460
clang::ParsedAttributes::addNewTypeAttr
ParsedAttr * addNewTypeAttr(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ParsedType typeArg, ParsedAttr::Syntax syntaxUsed)
Add an attribute with a single type argument.
Definition: ParsedAttr.h:1096
Used
@ Used
Definition: ObjCUnusedIVarsChecker.cpp:29
clang::AvailabilityChange::VersionRange
SourceRange VersionRange
The source range covering the version number.
Definition: ParsedAttr.h:168
clang::ParsedAttrInfo::diagAppertainsToDecl
virtual bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const
Check if this attribute appertains to D, and issue a diagnostic if not.
Definition: ParsedAttr.h:102
clang::detail::TypeTagForDatatypeData::MustBeNull
unsigned MustBeNull
Definition: ParsedAttr.h:199
clang::ArgsUnion
llvm::PointerUnion< Expr *, IdentifierLoc * > ArgsUnion
A union of the various pointer types that can be passed to an ParsedAttr as an argument.
Definition: ParsedAttr.h:221
llvm::SmallVector
Definition: LLVM.h:38
clang::ParsedAttr::appliesToDecl
bool appliesToDecl(const Decl *D, attr::SubjectMatchRule MatchRule) const
Definition: ParsedAttr.cpp:178
clang::ParsedAttrInfo
Definition: ParsedAttr.h:44
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::ParsedAttributesView::clearListOnly
void clearListOnly()
Definition: ParsedAttr.h:937
clang::AttributePool
Definition: ParsedAttr.h:781
clang::DiagnosticsEngine::ak_identifierinfo
@ ak_identifierinfo
IdentifierInfo.
Definition: Diagnostic.h:221
clang::AttributeFactory::TypeTagForDatatypeAllocSize
@ TypeTagForDatatypeAllocSize
Definition: ParsedAttr.h:734
clang::AttributePool::~AttributePool
~AttributePool()
Definition: ParsedAttr.h:810
clang::ParsedAttrInfo::ParsedAttrInfo
constexpr ParsedAttrInfo(AttributeCommonInfo::Kind AttrKind=AttributeCommonInfo::NoSemaHandlerAttribute)
Definition: ParsedAttr.h:77
Ownership.h
clang::ParsedAttr::getSemanticSpelling
unsigned getSemanticSpelling() const
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration ...
Definition: ParsedAttr.cpp:250
clang::LangAS::sycl_local
@ sycl_local
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:190
memcpy
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Definition: __clang_cuda_device_functions.h:1549
clang::AttributeArgumentNType
AttributeArgumentNType
These constants match the enumerated choices of err_attribute_argument_n_type and err_attribute_argum...
Definition: ParsedAttr.h:1130
clang::ParsedAttrInfo::isParamExpr
virtual bool isParamExpr(size_t N) const
Returns true if the specified parameter index for this attribute in Attr.td is an ExprArgument or Var...
Definition: ParsedAttr.h:132
clang::ParsedAttributesView::size
SizeType size() const
Definition: ParsedAttr.h:922
clang::ParsedAttrInfo::diagAppertainsToStmt
virtual bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const
Check if this attribute appertains to St, and issue a diagnostic if not.
Definition: ParsedAttr.h:107
clang::ParsedAttr::operator=
ParsedAttr & operator=(const ParsedAttr &)=delete
clang::ParsedAttr::getTypeArg
const ParsedType & getTypeArg() const
Definition: ParsedAttr.h:575
clang::ParsedAttrInfo::NumArgMembers
unsigned NumArgMembers
The number of non-fake arguments specified in the attribute definition.
Definition: ParsedAttr.h:52
clang::AttributeCommonInfo::getAttrName
const IdentifierInfo * getAttrName() const
Definition: AttributeCommonInfo.h:131
clang::AANT_ArgumentString
@ AANT_ArgumentString
Definition: ParsedAttr.h:1133
clang::AttributePool::create
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ArgsUnion *args, unsigned numArgs, ParsedAttr::Syntax syntax, SourceLocation ellipsisLoc=SourceLocation())
Definition: ParsedAttr.h:828
clang::ParsedAttributesView::front
ParsedAttr & front()
Definition: ParsedAttr.h:979
clang::ParsedAttributesView::end
iterator end()
Definition: ParsedAttr.h:976
clang::ParsedAttrInfo::Spelling::NormalizedFullName
const char * NormalizedFullName
Definition: ParsedAttr.h:70
clang::AttributePool::AttributePool
AttributePool(AttributeFactory &factory)
Create a new pool for a factory.
Definition: ParsedAttr.h:806
clang::ParsedAttrInfo::spellingIndexToSemanticSpelling
virtual unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const
Convert the spelling index of Attr to a semantic spelling enum value.
Definition: ParsedAttr.h:126
clang::detail::PropertyData::SetterId
IdentifierInfo * SetterId
Definition: ParsedAttr.h:202
clang::ParsedAttrInfo::Spelling
The syntaxes supported by this attribute and how they're spelled.
Definition: ParsedAttr.h:68
clang::ParsedAttr::getArg
ArgsUnion getArg(unsigned Arg) const
getArg - Return the specified argument.
Definition: ParsedAttr.h:494
clang::ParsedAttributesView::hasAttribute
bool hasAttribute(ParsedAttr::Kind K) const
Definition: ParsedAttr.h:996
clang::AttributePool::createTypeTagForDatatype
ParsedAttr * createTypeTagForDatatype(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *argumentKind, ParsedType matchingCType, bool layoutCompatible, bool mustBeNull, ParsedAttr::Syntax syntax)
Definition: ParsedAttr.h:874
clang::ParsedAttr::isTargetSpecificAttr
bool isTargetSpecificAttr() const
Definition: ParsedAttr.cpp:197
clang::ParsedAttr::hasProcessingCache
bool hasProcessingCache() const
Definition: ParsedAttr.h:467
clang::ParsedAttrInfo::IsKnownToGCC
unsigned IsKnownToGCC
True if this attribute has any spellings that are known to gcc.
Definition: ParsedAttr.h:64
clang::ParsedAttrInfo::OptArgs
unsigned OptArgs
The number of optional arguments of this attributes.
Definition: ParsedAttr.h:50
clang::ParsedAttr::checkAtLeastNumArgs
bool checkAtLeastNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at least as many args as Num.
Definition: ParsedAttr.cpp:291
clang::ParsedAttr::setIsPragmaClangAttribute
void setIsPragmaClangAttribute()
Definition: ParsedAttr.h:485
clang::ParsedAttributesView::begin
iterator begin()
Definition: ParsedAttr.h:974
clang::AttributeCommonInfo::Syntax
Syntax
The style used to specify an attribute.
Definition: AttributeCommonInfo.h:25
clang::ParsedAttributes::addNewPropertyAttr
ParsedAttr * addNewPropertyAttr(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierInfo *getterId, IdentifierInfo *setterId, ParsedAttr::Syntax syntaxUsed)
Add microsoft __delspec(property) attribute.
Definition: ParsedAttr.h:1108
b
__device__ __2f16 b
Definition: __clang_hip_libdevice_declares.h:314
clang::AANT_ArgumentConstantExpr
@ AANT_ArgumentConstantExpr
Definition: ParsedAttr.h:1135
clang::ParsedAttr::~ParsedAttr
~ParsedAttr()=delete
clang::ParsedAttributesView::operator[]
ParsedAttr & operator[](SizeType pos)
Definition: ParsedAttr.h:923
clang::StreamingDiagnostic::AddTaggedVal
void AddTaggedVal(uint64_t V, DiagnosticsEngine::ArgumentKind Kind) const
Definition: Diagnostic.h:1184
clang::detail::TypeTagForDatatypeData
Definition: ParsedAttr.h:196
clang::IdentifierLoc::Loc
SourceLocation Loc
Definition: ParsedAttr.h:212
clang::attr::SubjectMatchRule
SubjectMatchRule
A list of all the recognized kinds of attributes.
Definition: AttrSubjectMatchRules.h:19
clang::ParsedAttr::checkExactlyNumArgs
bool checkExactlyNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has exactly as many args as Num.
Definition: ParsedAttr.cpp:286
clang::LangAS::opencl_global_host
@ opencl_global_host
clang::LangAS::sycl_global_device
@ sycl_global_device
clang::detail::AvailabilityData
Describes the trailing object for Availability attribute in ParsedAttr.
Definition: ParsedAttr.h:180
clang::ExpectedFunctionWithProtoType
@ ExpectedFunctionWithProtoType
Definition: ParsedAttr.h:1154
uint64_t
unsigned long uint64_t
Definition: hlsl_basic_types.h:24
clang::CodeGen::AlignmentSource::Decl
@ Decl
The l-value was an access to a declared entity or something equivalently strong, like the address of ...
clang::AANT_ArgumentIdentifier
@ AANT_ArgumentIdentifier
Definition: ParsedAttr.h:1134
clang::AttributePool::takeAllFrom
void takeAllFrom(AttributePool &pool)
Take the given pool's allocations and add them to this pool.
Definition: ParsedAttr.h:823
clang::LangAS::opencl_local
@ opencl_local
clang::detail::AvailabilityData::AvailabilityData
AvailabilityData(const AvailabilityChange &Introduced, const AvailabilityChange &Deprecated, const AvailabilityChange &Obsoleted, SourceLocation Strict, const Expr *ReplaceExpr)
Definition: ParsedAttr.h:185
clang::detail::AvailabilityData::Replacement
const Expr * Replacement
Definition: ParsedAttr.h:183
clang::ParsedAttr::setProcessingCache
void setProcessingCache(unsigned value) const
Definition: ParsedAttr.h:474
clang::ParsedAttr::getNumArgs
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
Definition: ParsedAttr.h:491
clang::AttributeFactory
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
Definition: ParsedAttr.h:727
clang::detail::NumAvailabilitySlots
@ NumAvailabilitySlots
Definition: ParsedAttr.h:176
clang::ast_matchers::attr
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
Definition: ASTMatchersInternal.cpp:1030
clang::AttributePool::create
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param, const AvailabilityChange &introduced, const AvailabilityChange &deprecated, const AvailabilityChange &obsoleted, SourceLocation unavailable, const Expr *MessageExpr, ParsedAttr::Syntax syntax, SourceLocation strict, const Expr *ReplacementExpr)
Definition: ParsedAttr.h:847
clang::ParsedAttr::getStrictLoc
SourceLocation getStrictLoc() const
Definition: ParsedAttr.h:533
clang::ParsedAttr::isArgExpr
bool isArgExpr(unsigned Arg) const
Definition: ParsedAttr.h:499
clang::ParsedAttr::getMaxArgs
unsigned getMaxArgs() const
Definition: ParsedAttr.cpp:154
clang::ParsedAttrInfo::AttributeNotApplied
@ AttributeNotApplied
Definition: ParsedAttr.h:141
clang::ParsedAttrInfo::handleDeclAttribute
virtual AttrHandling handleDeclAttribute(Sema &S, Decl *D, const ParsedAttr &Attr) const
If this ParsedAttrInfo knows how to handle this ParsedAttr applied to this Decl then do so and return...
Definition: ParsedAttr.h:146
clang::ExpectedFunction
@ ExpectedFunction
Definition: ParsedAttr.h:1142
clang::AttributeFactory::PropertyAllocSize
@ PropertyAllocSize
Definition: ParsedAttr.h:738
clang::ParsedAttrInfo::acceptsLangOpts
virtual bool acceptsLangOpts(const LangOptions &LO) const
Check if this attribute is allowed by the language we are compiling.
Definition: ParsedAttr.h:118
clang::ParsedAttributesView::front
const ParsedAttr & front() const
Definition: ParsedAttr.h:983
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:208
clang::StreamingDiagnostic
The streaming interface shared between DiagnosticBuilder and PartialDiagnostic.
Definition: Diagnostic.h:1110
clang::ParsedAttributesView::const_iterator
Definition: ParsedAttr.h:947
Diagnostic.h
clang::ParsedAttr::isParamExpr
bool isParamExpr(size_t N) const
Definition: ParsedAttr.cpp:262
clang::ParsedAttributesView::addAllAtEnd
void addAllAtEnd(iterator B, iterator E)
Definition: ParsedAttr.h:966
clang::ParsedAttrInfo::AttrHandling
AttrHandling
Definition: ParsedAttr.h:138
clang::ParsedAttrInfo::NumArgs
unsigned NumArgs
The number of required arguments of this attribute.
Definition: ParsedAttr.h:48
clang::detail::AvailabilityData::Changes
AvailabilityChange Changes[NumAvailabilitySlots]
Definition: ParsedAttr.h:181
clang::detail::IntroducedSlot
@ IntroducedSlot
Definition: ParsedAttr.h:176
clang::ParsedAttrInfo::getAllBuiltin
static ArrayRef< const ParsedAttrInfo * > getAllBuiltin()
Definition: ParsedAttr.cpp:148
clang::ParsedAttributesView::addAll
void addAll(iterator B, iterator E)
Definition: ParsedAttr.h:958
clang::ParsedAttrInfo::IsType
unsigned IsType
True if this attribute applies to types.
Definition: ParsedAttr.h:60
clang::detail::AvailabilityData::StrictLoc
SourceLocation StrictLoc
Definition: ParsedAttr.h:182
clang::ParsedAttr::getLayoutCompatible
bool getLayoutCompatible() const
Definition: ParsedAttr.h:563
clang::ParsedAttr
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:233
clang::ParsedAttributes::addNew
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ArgsUnion *args, unsigned numArgs, ParsedAttr::Syntax syntax, SourceLocation ellipsisLoc=SourceLocation())
Add attribute with expression arguments.
Definition: ParsedAttr.h:1043
clang::ParsedAttributesView::addAtEnd
void addAtEnd(ParsedAttr *newAttr)
Definition: ParsedAttr.h:926
clang::ParsedAttr::isTypeAttr
bool isTypeAttr() const
Definition: ParsedAttr.cpp:201
clang::AttributePool::createTypeAttribute
ParsedAttr * createTypeAttribute(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, ParsedType typeArg, ParsedAttr::Syntax syntaxUsed)
Definition: ParsedAttr.h:885
clang::detail::ObsoletedSlot
@ ObsoletedSlot
Definition: ParsedAttr.h:176
clang::LangAS::opencl_constant
@ opencl_constant
AttrSubjectMatchRules.h
clang::AttributeFactory::AttributeFactory
AttributeFactory()
Definition: ParsedAttr.cpp:54
clang::ParsedAttr::handleAttrWithDelayedArgs
void handleAttrWithDelayedArgs(Sema &S, Decl *D) const
Definition: ParsedAttr.cpp:266
clang::ParsedAttributes::addNew
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param, const AvailabilityChange &introduced, const AvailabilityChange &deprecated, const AvailabilityChange &obsoleted, SourceLocation unavailable, const Expr *MessageExpr, ParsedAttr::Syntax syntax, SourceLocation strict, const Expr *ReplacementExpr)
Add availability attribute.
Definition: ParsedAttr.h:1055
clang::ParsedAttributesView::const_iterator::const_iterator
const_iterator(VecTy::const_iterator I)
Definition: ParsedAttr.h:952
clang::ParsedAttrInfo::get
static const ParsedAttrInfo & get(const AttributeCommonInfo &A)
Definition: ParsedAttr.cpp:112
clang::ParsedAttr::diagnoseMutualExclusion
bool diagnoseMutualExclusion(class Sema &S, const Stmt *St) const
Definition: ParsedAttr.h:641
clang::ParsedAttr::asSYCLLangAS
LangAS asSYCLLangAS() const
If this is an OpenCL address space attribute, returns its SYCL representation in LangAS,...
Definition: ParsedAttr.h:697
clang::ParsedAttributesView::addAllAtEnd
void addAllAtEnd(const_iterator B, const_iterator E)
Definition: ParsedAttr.h:970
clang::ParsedType
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition: Ownership.h:243
clang::detail::PropertyData::GetterId
IdentifierInfo * GetterId
Definition: ParsedAttr.h:202
clang::ParsedAttrInfo::~ParsedAttrInfo
virtual ~ParsedAttrInfo()=default
clang::operator<<
const StreamingDiagnostic & operator<<(const StreamingDiagnostic &DB, const ASTContext::SectionInfo &Section)
Insertion operator for diagnostics.
Definition: ASTContext.cpp:12322
clang::ExpectedTypeOrNamespace
@ ExpectedTypeOrNamespace
Definition: ParsedAttr.h:1151
clang::ParsedAttributesView::back
const ParsedAttr & back() const
Definition: ParsedAttr.h:991
clang::detail::DeprecatedSlot
@ DeprecatedSlot
Definition: ParsedAttr.h:176
clang::ParsedAttr::getAvailabilityObsoleted
const AvailabilityChange & getAvailabilityObsoleted() const
Definition: ParsedAttr.h:527
clang::ParsedAttributesView::operator[]
const ParsedAttr & operator[](SizeType pos) const
Definition: ParsedAttr.h:924
clang::ParsedAttr::getUnavailableLoc
SourceLocation getUnavailableLoc() const
Definition: ParsedAttr.h:539
clang::ParsedAttributesView::empty
bool empty() const
Definition: ParsedAttr.h:921
clang::ParsedAttr::slidesFromDeclToDeclSpecLegacyBehavior
bool slidesFromDeclToDeclSpecLegacyBehavior() const
Returns whether a [[]] attribute, if specified ahead of a declaration, should be applied to the decl-...
Definition: ParsedAttr.cpp:215
clang::ParsedAttrInfo::Spelling::Syntax
AttributeCommonInfo::Syntax Syntax
Definition: ParsedAttr.h:69
clang::ParsedAttrInfo::IsSupportedByPragmaAttribute
unsigned IsSupportedByPragmaAttribute
True if this attribute is supported by #pragma clang attribute.
Definition: ParsedAttr.h:66
clang::OpaquePtr< QualType >
clang::AvailabilityChange
Represents information about a change in availability for an entity, which is part of the encoding of...
Definition: ParsedAttr.h:160
clang::ParsedAttrInfo::NotHandled
@ NotHandled
Definition: ParsedAttr.h:139
clang::ParsedAttr::existsInTarget
bool existsInTarget(const TargetInfo &Target) const
Definition: ParsedAttr.cpp:205
clang::AttributePool::create
ParsedAttr * create(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param1, IdentifierLoc *Param2, IdentifierLoc *Param3, ParsedAttr::Syntax syntax)
Definition: ParsedAttr.h:861
clang::LangAS
LangAS
Defines the address space values used by the address space qualifier of QualType.
Definition: AddressSpaces.h:25
clang::ParsedAttributesView::Range
SourceRange Range
Definition: ParsedAttr.h:914
clang::ParsedAttr::isKnownToGCC
bool isKnownToGCC() const
Definition: ParsedAttr.cpp:209
clang::ParsedAttributes::takeAllFrom
void takeAllFrom(ParsedAttributes &Other)
Definition: ParsedAttr.h:1019
clang::transformer::remove
ASTEdit remove(RangeSelector S)
Removes the source selected by S.
Definition: RewriteRule.cpp:146
clang::ParsedAttr::hasVariadicArg
bool hasVariadicArg() const
Definition: ParsedAttr.cpp:254
clang::AttributePool::clear
void clear()
Definition: ParsedAttr.h:817
clang::ParsedAttr::checkAtMostNumArgs
bool checkAtMostNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at most as many args as Num.
Definition: ParsedAttr.cpp:296
clang::ParsedAttr::hasMacroIdentifier
bool hasMacroIdentifier() const
Returns true if this attribute was declared in a macro.
Definition: ParsedAttr.h:601
SourceLocation.h
clang::ParsedAttr::diagnoseMutualExclusion
bool diagnoseMutualExclusion(class Sema &S, const Decl *D) const
Definition: ParsedAttr.cpp:174
clang::ParsedAttr::getAvailabilityIntroduced
const AvailabilityChange & getAvailabilityIntroduced() const
Definition: ParsedAttr.h:515
clang::ParsedAttributesView::iterator::operator*
reference operator*() const
Definition: ParsedAttr.h:944
false
#define false
Definition: stdbool.h:22
UINT_MAX
#define UINT_MAX
Definition: limits.h:56
clang::ParsedAttr::setInvalid
void setInvalid(bool b=true) const
Definition: ParsedAttr.h:465
clang::ParsedAttr::hasParsedType
bool hasParsedType() const
Definition: ParsedAttr.h:457
llvm::ArrayRef
Definition: LLVM.h:34
clang::ParsedAttributesView::iterator::iterator
iterator(VecTy::iterator I)
Definition: ParsedAttr.h:943
clang::LangAS::opencl_global
@ opencl_global
clang::ParsedAttr::setUsedAsTypeAttr
void setUsedAsTypeAttr(bool Used=true)
Definition: ParsedAttr.h:480
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::AttributeCommonInfo
Definition: AttributeCommonInfo.h:22
clang::ParsedAttr::isStmtAttr
bool isStmtAttr() const
Definition: ParsedAttr.cpp:203
clang::AANT_ArgumentIntOrBool
@ AANT_ArgumentIntOrBool
Definition: ParsedAttr.h:1131
clang::AttributeFactory::AvailabilityAllocSize
@ AvailabilityAllocSize
Definition: ParsedAttr.h:730
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:354
clang::ParsedAttributes::ParsedAttributes
ParsedAttributes(AttributeFactory &factory)
Definition: ParsedAttr.h:1014
clang::ExpectedVariableFieldOrTag
@ ExpectedVariableFieldOrTag
Definition: ParsedAttr.h:1150
clang::ParsedAttributes
ParsedAttributes - A collection of parsed attributes.
Definition: ParsedAttr.h:1012
clang::detail::PropertyData
Definition: ParsedAttr.h:201
clang::AttributeCommonInfo::NoSemaHandlerAttribute
@ NoSemaHandlerAttribute
Definition: AttributeCommonInfo.h:59
clang::ParsedAttr::diagnoseAppertainsTo
bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const
Definition: ParsedAttr.cpp:166
clang::ParsedAttr::getMustBeNull
bool getMustBeNull() const
Definition: ParsedAttr.h:569
clang::ParsedAttr::getInfo
const ParsedAttrInfo & getInfo() const
Definition: ParsedAttr.h:718
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:84
clang::AttributeDeclKind
AttributeDeclKind
These constants match the enumerated choices of warn_attribute_wrong_decl_type and err_attribute_wron...
Definition: ParsedAttr.h:1141
clang::ParsedAttributesView::addAll
void addAll(const_iterator B, const_iterator E)
Definition: ParsedAttr.h:962
clang::AttributeCommonInfo::AttributeCommonInfo
AttributeCommonInfo(SourceRange AttrRange)
Definition: AttributeCommonInfo.h:79
clang::LangOptions
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Definition: LangOptions.h:78
clang::ParsedAttrInfoRegistry
llvm::Registry< ParsedAttrInfo > ParsedAttrInfoRegistry
Definition: ParsedAttr.h:155
clang::ParsedAttr::isPragmaClangAttribute
bool isPragmaClangAttribute() const
True if the attribute is specified using '#pragma clang attribute'.
Definition: ParsedAttr.h:483
clang::ParsedAttr::acceptsExprPack
bool acceptsExprPack() const
Definition: ParsedAttr.cpp:248
clang::detail::TypeTagForDatatypeData::LayoutCompatible
unsigned LayoutCompatible
Definition: ParsedAttr.h:198
clang::ExpectedVariableOrField
@ ExpectedVariableOrField
Definition: ParsedAttr.h:1149
clang::ParsedAttributesView::remove
void remove(ParsedAttr *ToBeRemoved)
Definition: ParsedAttr.h:931
clang::LangAS::Default
@ Default
clang::ExpectedFunctionMethodOrParameter
@ ExpectedFunctionMethodOrParameter
Definition: ParsedAttr.h:1147
clang::ParsedAttributesView::iterator::iterator
iterator()
Definition: ParsedAttr.h:942
clang::LangAS::sycl_private
@ sycl_private
clang::ExpectedFunctionMethodOrBlock
@ ExpectedFunctionMethodOrBlock
Definition: ParsedAttr.h:1146
clang::ParsedAttributesView::back
ParsedAttr & back()
Definition: ParsedAttr.h:987
clang
Definition: CalledOnceCheck.h:17
clang::ParsedAttr::hasCustomParsing
bool hasCustomParsing() const
Definition: ParsedAttr.cpp:162
clang::ParsedAttrInfo::Spellings
ArrayRef< Spelling > Spellings
Definition: ParsedAttr.h:72
clang::ParsedAttrInfo::HasCustomParsing
unsigned HasCustomParsing
True if the parsing does not match the semantic content.
Definition: ParsedAttr.h:54
clang::ParsedAttr::getMatchingCType
const ParsedType & getMatchingCType() const
Definition: ParsedAttr.h:557
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:69
clang::ParsedAttr::getPropertyDataGetter
IdentifierInfo * getPropertyDataGetter() const
Definition: ParsedAttr.h:580
clang::ExpectedUnion
@ ExpectedUnion
Definition: ParsedAttr.h:1143
clang::ParsedAttr::diagnoseLangOpts
bool diagnoseLangOpts(class Sema &S) const
Definition: ParsedAttr.cpp:190
clang::ParsedAttr::isInvalid
bool isInvalid() const
Definition: ParsedAttr.h:464
clang::detail::TypeTagForDatatypeData::MatchingCType
ParsedType MatchingCType
Definition: ParsedAttr.h:197
clang::AttributeFactory::~AttributeFactory
~AttributeFactory()
clang::ParsedAttrInfo::IsStmt
unsigned IsStmt
True if this attribute applies to statements.
Definition: ParsedAttr.h:62
clang::ParsedAttr::getMatchRules
void getMatchRules(const LangOptions &LangOpts, SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &MatchRules) const
Definition: ParsedAttr.cpp:183
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:110
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:41
clang::ParsedAttrInfo::ParsedAttrInfo
constexpr ParsedAttrInfo(AttributeCommonInfo::Kind AttrKind, unsigned NumArgs, unsigned OptArgs, unsigned NumArgMembers, unsigned HasCustomParsing, unsigned AcceptsExprPack, unsigned IsTargetSpecific, unsigned IsType, unsigned IsStmt, unsigned IsKnownToGCC, unsigned IsSupportedByPragmaAttribute, ArrayRef< Spelling > Spellings, ArrayRef< const char * > ArgNames)
Definition: ParsedAttr.h:83
clang::LangAS::opencl_global_device
@ opencl_global_device
clang::ParsedAttr::getMacroIdentifier
IdentifierInfo * getMacroIdentifier() const
Return the macro identifier if this attribute was declared in a macro.
Definition: ParsedAttr.h:605
clang::ParsedAttr::getProcessingCache
unsigned getProcessingCache() const
Definition: ParsedAttr.h:469
clang::ParsedAttributesView::const_iterator::const_iterator
const_iterator()
Definition: ParsedAttr.h:951
clang::ParsedAttributesView::iterator
Definition: ParsedAttr.h:939
clang::ParsedAttr::getReplacementExpr
const Expr * getReplacementExpr() const
Definition: ParsedAttr.h:551
clang::ExpectedFunctionOrMethod
@ ExpectedFunctionOrMethod
Definition: ParsedAttr.h:1145
clang::LangAS::sycl_global_host
@ sycl_global_host
clang::ExpectedKernelFunction
@ ExpectedKernelFunction
Definition: ParsedAttr.h:1153
clang::AANT_ArgumentIntegerConstant
@ AANT_ArgumentIntegerConstant
Definition: ParsedAttr.h:1132
llvm::SmallVectorImpl
Definition: Randstruct.h:18
clang::ParsedAttributes::clear
void clear()
Definition: ParsedAttr.h:1036
clang::ParsedAttributesView::end
const_iterator end() const
Definition: ParsedAttr.h:977
true
#define true
Definition: stdbool.h:21
clang::ExpectedFunctionVariableOrClass
@ ExpectedFunctionVariableOrClass
Definition: ParsedAttr.h:1152
clang::ParsedAttr::isArgIdent
bool isArgIdent(unsigned Arg) const
Definition: ParsedAttr.h:507
clang::ParsedAttributes::getPool
AttributePool & getPool() const
Definition: ParsedAttr.h:1017
clang::ParsedAttributesView
Definition: ParsedAttr.h:909
clang::Expr
This represents one expression.
Definition: Expr.h:109
clang::ParsedAttributesView::const_iterator::operator*
reference operator*() const
Definition: ParsedAttr.h:954
clang::AANT_ArgumentBuiltinFunction
@ AANT_ArgumentBuiltinFunction
Definition: ParsedAttr.h:1136
clang::ParsedAttr::asOpenCLLangAS
LangAS asOpenCLLangAS() const
If this is an OpenCL address space attribute, returns its representation in LangAS,...
Definition: ParsedAttr.h:674
clang::ParsedAttr::getMacroExpansionLoc
SourceLocation getMacroExpansionLoc() const
Definition: ParsedAttr.h:607
clang::AvailabilityChange::Version
VersionTuple Version
The version number at which the change occurred.
Definition: ParsedAttr.h:165
clang::ParsedAttr::getArgAsIdent
IdentifierLoc * getArgAsIdent(unsigned Arg) const
Definition: ParsedAttr.h:511
clang::ParsedAttributes::addNew
ParsedAttr * addNew(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *Param1, IdentifierLoc *Param2, IdentifierLoc *Param3, ParsedAttr::Syntax syntax)
Add objc_bridge_related attribute.
Definition: ParsedAttr.h:1071
clang::IdentifierLoc
Wraps an identifier and optional source location for the identifier.
Definition: ParsedAttr.h:211
clang::ParsedAttr::getPropertyDataSetter
IdentifierInfo * getPropertyDataSetter() const
Definition: ParsedAttr.h:586
clang::ParsedAttributes::addNewTypeTagForDatatype
ParsedAttr * addNewTypeTagForDatatype(IdentifierInfo *attrName, SourceRange attrRange, IdentifierInfo *scopeName, SourceLocation scopeLoc, IdentifierLoc *argumentKind, ParsedType matchingCType, bool layoutCompatible, bool mustBeNull, ParsedAttr::Syntax syntax)
Add type_tag_for_datatype attribute.
Definition: ParsedAttr.h:1083
clang::LangAS::opencl_generic
@ opencl_generic
clang::RISCV::Invalid
@ Invalid
Definition: RISCVVIntrinsicUtils.h:148
clang::ParsedAttrInfo::diagMutualExclusion
virtual bool diagMutualExclusion(Sema &S, const ParsedAttr &A, const Decl *D) const
Check if the given attribute is mutually exclusive with other attributes already applied to the given...
Definition: ParsedAttr.h:113
clang::ParsedAttr::setMacroIdentifier
void setMacroIdentifier(IdentifierInfo *MacroName, SourceLocation Loc)
Set the macro identifier info object that this parsed attribute was declared in if it was declared in...
Definition: ParsedAttr.h:595
clang::AvailabilityChange::isValid
bool isValid() const
Determine whether this availability change is valid.
Definition: ParsedAttr.h:171
clang::ParsedAttr::isSupportedByPragmaAttribute
bool isSupportedByPragmaAttribute() const
Definition: ParsedAttr.cpp:211
clang::takeAndConcatenateAttrs
void takeAndConcatenateAttrs(ParsedAttributes &First, ParsedAttributes &Second, ParsedAttributes &Result)
Consumes the attributes from First and Second and concatenates them into Result.
Definition: ParsedAttr.cpp:302
clang::ParsedAttrInfo::existsInTarget
virtual bool existsInTarget(const TargetInfo &Target) const
Check if this attribute is allowed when compiling for the given target.
Definition: ParsedAttr.h:121
clang::ParsedAttrInfo::AcceptsExprPack
unsigned AcceptsExprPack
Definition: ParsedAttr.h:56
clang::ParsedAttr::isPackExpansion
bool isPackExpansion() const
Definition: ParsedAttr.h:487
clang::ParsedAttrInfo::getPragmaAttributeMatchRules
virtual void getPragmaAttributeMatchRules(llvm::SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &Rules, const LangOptions &LangOpts) const
Populate Rules with the match rules of this attribute.
Definition: ParsedAttr.h:134
clang::ParsedAttr::getArgAsExpr
Expr * getArgAsExpr(unsigned Arg) const
Definition: ParsedAttr.h:503
clang::detail::AvailabilitySlot
AvailabilitySlot
Definition: ParsedAttr.h:175
clang::IdentifierLoc::create
static IdentifierLoc * create(ASTContext &Ctx, SourceLocation Loc, IdentifierInfo *Ident)
Definition: ParsedAttr.cpp:31
clang::ParsedAttrInfo::AttrKind
unsigned AttrKind
Corresponds to the Kind enum.
Definition: ParsedAttr.h:46