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