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