clang  16.0.0git
ParsedAttr.cpp
Go to the documentation of this file.
1 //======- ParsedAttr.cpp --------------------------------------------------===//
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 implementation
10 //
11 //===----------------------------------------------------------------------===//
12 
13 #include "clang/Sema/ParsedAttr.h"
14 #include "clang/AST/ASTContext.h"
17 #include "clang/Basic/TargetInfo.h"
19 #include "llvm/ADT/SmallString.h"
20 #include "llvm/ADT/SmallVector.h"
21 #include "llvm/ADT/StringRef.h"
22 #include "llvm/Support/ManagedStatic.h"
23 #include <cassert>
24 #include <cstddef>
25 #include <utility>
26 
27 using namespace clang;
28 
29 LLVM_INSTANTIATE_REGISTRY(ParsedAttrInfoRegistry)
30 
32  IdentifierInfo *Ident) {
33  IdentifierLoc *Result = new (Ctx) IdentifierLoc;
34  Result->Loc = Loc;
35  Result->Ident = Ident;
36  return Result;
37 }
38 
39 size_t ParsedAttr::allocated_size() const {
40  if (IsAvailability) return AttributeFactory::AvailabilityAllocSize;
41  else if (IsTypeTagForDatatype)
43  else if (IsProperty)
45  else if (HasParsedType)
46  return totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
48  detail::PropertyData>(0, 0, 0, 1, 0);
49  return totalSizeToAlloc<ArgsUnion, detail::AvailabilityData,
51  detail::PropertyData>(NumArgs, 0, 0, 0, 0);
52 }
53 
55  // Go ahead and configure all the inline capacity. This is just a memset.
56  FreeLists.resize(InlineFreeListsCapacity);
57 }
59 
60 static size_t getFreeListIndexForSize(size_t size) {
61  assert(size >= sizeof(ParsedAttr));
62  assert((size % sizeof(void*)) == 0);
63  return ((size - sizeof(ParsedAttr)) / sizeof(void *));
64 }
65 
66 void *AttributeFactory::allocate(size_t size) {
67  // Check for a previously reclaimed attribute.
68  size_t index = getFreeListIndexForSize(size);
69  if (index < FreeLists.size() && !FreeLists[index].empty()) {
70  ParsedAttr *attr = FreeLists[index].back();
71  FreeLists[index].pop_back();
72  return attr;
73  }
74 
75  // Otherwise, allocate something new.
76  return Alloc.Allocate(size, alignof(AttributeFactory));
77 }
78 
79 void AttributeFactory::deallocate(ParsedAttr *Attr) {
80  size_t size = Attr->allocated_size();
81  size_t freeListIndex = getFreeListIndexForSize(size);
82 
83  // Expand FreeLists to the appropriate size, if required.
84  if (freeListIndex >= FreeLists.size())
85  FreeLists.resize(freeListIndex + 1);
86 
87 #ifndef NDEBUG
88  // In debug mode, zero out the attribute to help find memory overwriting.
89  memset(Attr, 0, size);
90 #endif
91 
92  // Add 'Attr' to the appropriate free-list.
93  FreeLists[freeListIndex].push_back(Attr);
94 }
95 
96 void AttributeFactory::reclaimPool(AttributePool &cur) {
97  for (ParsedAttr *AL : cur.Attrs)
98  deallocate(AL);
99 }
100 
101 void AttributePool::takePool(AttributePool &pool) {
102  Attrs.insert(Attrs.end(), pool.Attrs.begin(), pool.Attrs.end());
103  pool.Attrs.clear();
104 }
105 
106 namespace {
107 
108 #include "clang/Sema/AttrParsedAttrImpl.inc"
109 
110 } // namespace
111 
113  // If we have a ParsedAttrInfo for this ParsedAttr then return that.
114  if ((size_t)A.getParsedKind() < std::size(AttrInfoMap))
115  return *AttrInfoMap[A.getParsedKind()];
116 
117  // If this is an ignored attribute then return an appropriate ParsedAttrInfo.
118  static const ParsedAttrInfo IgnoredParsedAttrInfo(
121  return IgnoredParsedAttrInfo;
122 
123  // Otherwise this may be an attribute defined by a plugin. First instantiate
124  // all plugin attributes if we haven't already done so.
125  static llvm::ManagedStatic<std::list<std::unique_ptr<ParsedAttrInfo>>>
126  PluginAttrInstances;
127  if (PluginAttrInstances->empty())
128  for (auto It : ParsedAttrInfoRegistry::entries())
129  PluginAttrInstances->emplace_back(It.instantiate());
130 
131  // Search for a ParsedAttrInfo whose name and syntax match.
132  std::string FullName = A.getNormalizedFullName();
133  AttributeCommonInfo::Syntax SyntaxUsed = A.getSyntax();
135  SyntaxUsed = AttributeCommonInfo::AS_Keyword;
136 
137  for (auto &Ptr : *PluginAttrInstances)
138  for (auto &S : Ptr->Spellings)
139  if (S.Syntax == SyntaxUsed && S.NormalizedFullName == FullName)
140  return *Ptr;
141 
142  // If we failed to find a match then return a default ParsedAttrInfo.
143  static const ParsedAttrInfo DefaultParsedAttrInfo(
145  return DefaultParsedAttrInfo;
146 }
147 
149  return llvm::makeArrayRef(AttrInfoMap);
150 }
151 
152 unsigned ParsedAttr::getMinArgs() const { return getInfo().NumArgs; }
153 
154 unsigned ParsedAttr::getMaxArgs() const {
155  return getMinArgs() + getInfo().OptArgs;
156 }
157 
159  return getInfo().NumArgMembers;
160 }
161 
163  return getInfo().HasCustomParsing;
164 }
165 
166 bool ParsedAttr::diagnoseAppertainsTo(Sema &S, const Decl *D) const {
167  return getInfo().diagAppertainsToDecl(S, *this, D);
168 }
169 
170 bool ParsedAttr::diagnoseAppertainsTo(Sema &S, const Stmt *St) const {
171  return getInfo().diagAppertainsToStmt(S, *this, St);
172 }
173 
175  return getInfo().diagMutualExclusion(S, *this, D);
176 }
177 
179  attr::SubjectMatchRule MatchRule) const {
180  return checkAttributeMatchRuleAppliesTo(D, MatchRule);
181 }
182 
184  const LangOptions &LangOpts,
185  SmallVectorImpl<std::pair<attr::SubjectMatchRule, bool>> &MatchRules)
186  const {
187  return getInfo().getPragmaAttributeMatchRules(MatchRules, LangOpts);
188 }
189 
191  if (getInfo().acceptsLangOpts(S.getLangOpts()))
192  return true;
193  S.Diag(getLoc(), diag::warn_attribute_ignored) << *this;
194  return false;
195 }
196 
198  return getInfo().IsTargetSpecific;
199 }
200 
201 bool ParsedAttr::isTypeAttr() const { return getInfo().IsType; }
202 
203 bool ParsedAttr::isStmtAttr() const { return getInfo().IsStmt; }
204 
205 bool ParsedAttr::existsInTarget(const TargetInfo &Target) const {
206  return getInfo().existsInTarget(Target);
207 }
208 
210 
213 }
214 
216  assert(isStandardAttributeSyntax());
217 
218  // We have historically allowed some type attributes with standard attribute
219  // syntax to slide to the decl-specifier-seq, so we have to keep supporting
220  // it. This property is consciously not defined as a flag in Attr.td because
221  // we don't want new attributes to specify it.
222  //
223  // Note: No new entries should be added to this list. Entries should be
224  // removed from this list after a suitable deprecation period, provided that
225  // there are no compatibility considerations with other compilers. If
226  // possible, we would like this list to go away entirely.
227  switch (getParsedKind()) {
228  case AT_AddressSpace:
229  case AT_OpenCLPrivateAddressSpace:
230  case AT_OpenCLGlobalAddressSpace:
231  case AT_OpenCLGlobalDeviceAddressSpace:
232  case AT_OpenCLGlobalHostAddressSpace:
233  case AT_OpenCLLocalAddressSpace:
234  case AT_OpenCLConstantAddressSpace:
235  case AT_OpenCLGenericAddressSpace:
236  case AT_NeonPolyVectorType:
237  case AT_NeonVectorType:
238  case AT_ArmMveStrictPolymorphism:
239  case AT_BTFTypeTag:
240  case AT_ObjCGC:
241  case AT_MatrixType:
242  return true;
243  default:
244  return false;
245  }
246 }
247 
249 
252 }
253 
255  // If the attribute has the maximum number of optional arguments, we will
256  // claim that as being variadic. If we someday get an attribute that
257  // legitimately bumps up against that maximum, we can use another bit to track
258  // whether it's truly variadic or not.
259  return getInfo().OptArgs == 15;
260 }
261 
262 bool ParsedAttr::isParamExpr(size_t N) const {
263  return getInfo().isParamExpr(N);
264 }
265 
267  ::handleAttrWithDelayedArgs(S, D, *this);
268 }
269 
270 static unsigned getNumAttributeArgs(const ParsedAttr &AL) {
271  // FIXME: Include the type in the argument list.
272  return AL.getNumArgs() + AL.hasParsedType();
273 }
274 
275 template <typename Compare>
276 static bool checkAttributeNumArgsImpl(Sema &S, const ParsedAttr &AL,
277  unsigned Num, unsigned Diag,
278  Compare Comp) {
279  if (Comp(getNumAttributeArgs(AL), Num)) {
280  S.Diag(AL.getLoc(), Diag) << AL << Num;
281  return false;
282  }
283  return true;
284 }
285 
286 bool ParsedAttr::checkExactlyNumArgs(Sema &S, unsigned Num) const {
287  return checkAttributeNumArgsImpl(S, *this, Num,
288  diag::err_attribute_wrong_number_arguments,
289  std::not_equal_to<unsigned>());
290 }
291 bool ParsedAttr::checkAtLeastNumArgs(Sema &S, unsigned Num) const {
292  return checkAttributeNumArgsImpl(S, *this, Num,
293  diag::err_attribute_too_few_arguments,
294  std::less<unsigned>());
295 }
296 bool ParsedAttr::checkAtMostNumArgs(Sema &S, unsigned Num) const {
297  return checkAttributeNumArgsImpl(S, *this, Num,
298  diag::err_attribute_too_many_arguments,
299  std::greater<unsigned>());
300 }
301 
303  ParsedAttributes &Second,
304  ParsedAttributes &Result) {
305  // Note that takeAllFrom() puts the attributes at the beginning of the list,
306  // so to obtain the correct ordering, we add `Second`, then `First`.
307  Result.takeAllFrom(Second);
308  Result.takeAllFrom(First);
309  if (First.Range.getBegin().isValid())
310  Result.Range.setBegin(First.Range.getBegin());
311  else
312  Result.Range.setBegin(Second.Range.getBegin());
313  if (Second.Range.getEnd().isValid())
314  Result.Range.setEnd(Second.Range.getEnd());
315  else
316  Result.Range.setEnd(First.Range.getEnd());
317 }
clang::AttributeCommonInfo::getParsedKind
Kind getParsedKind() const
Definition: AttributeCommonInfo.h:129
clang::ParsedAttr::getMinArgs
unsigned getMinArgs() const
Definition: ParsedAttr.cpp:152
clang::AttributeCommonInfo::getLoc
SourceLocation getLoc() const
Definition: AttributeCommonInfo.h:132
clang::ParsedAttr::getNumArgMembers
unsigned getNumArgMembers() const
Definition: ParsedAttr.cpp:158
clang::ParsedAttrInfo::IsTargetSpecific
unsigned IsTargetSpecific
True if this attribute is only available for certain targets.
Definition: ParsedAttr.h:58
string
string(SUBSTRING ${CMAKE_CURRENT_BINARY_DIR} 0 ${PATH_LIB_START} PATH_HEAD) string(SUBSTRING $
Definition: CMakeLists.txt:22
clang::interp::Comp
bool Comp(InterpState &S, CodePtr OpPC)
1) Pops the value from the stack.
Definition: Interp.h:401
Diag
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
Definition: LiteralSupport.cpp:79
clang::ParsedAttrInfo::diagAppertainsToDecl
virtual bool diagAppertainsToDecl(Sema &S, const ParsedAttr &Attr, const Decl *D) const
Check if this attribute appertains to D, and issue a diagnostic if not.
Definition: ParsedAttr.h:102
SemaInternal.h
clang::ArgsUnion
llvm::PointerUnion< Expr *, IdentifierLoc * > ArgsUnion
A union of the various pointer types that can be passed to an ParsedAttr as an argument.
Definition: ParsedAttr.h:221
clang::ParsedAttr::appliesToDecl
bool appliesToDecl(const Decl *D, attr::SubjectMatchRule MatchRule) const
Definition: ParsedAttr.cpp:178
clang::ParsedAttrInfo
Definition: ParsedAttr.h:44
clang::SourceLocation
Encodes a location in the source.
Definition: SourceLocation.h:86
clang::SourceRange::getBegin
SourceLocation getBegin() const
Definition: SourceLocation.h:219
clang::AttributePool
Definition: ParsedAttr.h:792
TargetInfo.h
clang::MultiVersionKind::Target
@ Target
clang::ParsedAttr::getSemanticSpelling
unsigned getSemanticSpelling() const
If the parsed attribute has a semantic equivalent, and it would have a semantic Spelling enumeration ...
Definition: ParsedAttr.cpp:250
clang::Sema::Diag
SemaDiagnosticBuilder Diag(SourceLocation Loc, unsigned DiagID, bool DeferHint=false)
Emit a diagnostic.
Definition: Sema.cpp:1881
clang::TargetInfo
Exposes information about the current target.
Definition: TargetInfo.h:205
clang::ParsedAttrInfo::isParamExpr
virtual bool isParamExpr(size_t N) const
Returns true if the specified parameter index for this attribute in Attr.td is an ExprArgument or Var...
Definition: ParsedAttr.h:132
clang::ParsedAttrInfo::diagAppertainsToStmt
virtual bool diagAppertainsToStmt(Sema &S, const ParsedAttr &Attr, const Stmt *St) const
Check if this attribute appertains to St, and issue a diagnostic if not.
Definition: ParsedAttr.h:107
clang::ComparisonCategoryType::First
@ First
clang::ParsedAttrInfo::NumArgMembers
unsigned NumArgMembers
The number of non-fake arguments specified in the attribute definition.
Definition: ParsedAttr.h:52
getNumAttributeArgs
static unsigned getNumAttributeArgs(const ParsedAttr &AL)
Definition: ParsedAttr.cpp:270
clang::ParsedAttrInfo::spellingIndexToSemanticSpelling
virtual unsigned spellingIndexToSemanticSpelling(const ParsedAttr &Attr) const
Convert the spelling index of Attr to a semantic spelling enum value.
Definition: ParsedAttr.h:126
clang::ParsedAttr::isTargetSpecificAttr
bool isTargetSpecificAttr() const
Definition: ParsedAttr.cpp:197
clang::ParsedAttrInfo::IsKnownToGCC
unsigned IsKnownToGCC
True if this attribute has any spellings that are known to gcc.
Definition: ParsedAttr.h:64
clang::ParsedAttrInfo::OptArgs
unsigned OptArgs
The number of optional arguments of this attributes.
Definition: ParsedAttr.h:50
clang::ParsedAttr::checkAtLeastNumArgs
bool checkAtLeastNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at least as many args as Num.
Definition: ParsedAttr.cpp:291
clang::AttributeCommonInfo::Syntax
Syntax
The style used to specify an attribute.
Definition: AttributeCommonInfo.h:25
clang::detail::TypeTagForDatatypeData
Definition: ParsedAttr.h:196
clang::attr::SubjectMatchRule
SubjectMatchRule
A list of all the recognized kinds of attributes.
Definition: AttrSubjectMatchRules.h:19
clang::ParsedAttr::checkExactlyNumArgs
bool checkExactlyNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has exactly as many args as Num.
Definition: ParsedAttr.cpp:286
clang::detail::AvailabilityData
Describes the trailing object for Availability attribute in ParsedAttr.
Definition: ParsedAttr.h:180
clang::AttributeFactory::PropertyAllocSize
@ PropertyAllocSize
Definition: ParsedAttr.h:749
clang::AttributeCommonInfo::AS_Keyword
@ AS_Keyword
__ptr16, alignas(...), etc.
Definition: AttributeCommonInfo.h:42
clang::Sema::getLangOpts
const LangOptions & getLangOpts() const
Definition: Sema.h:1630
clang::ParsedAttr::getNumArgs
unsigned getNumArgs() const
getNumArgs - Return the number of actual arguments to this attribute.
Definition: ParsedAttr.h:491
clang::AttributeFactory
A factory, from which one makes pools, from which one creates individual attributes which are dealloc...
Definition: ParsedAttr.h:738
clang::AttributeCommonInfo::UnknownAttribute
@ UnknownAttribute
Definition: AttributeCommonInfo.h:61
clang::interp::Compare
ComparisonCategoryResult Compare(const T &X, const T &Y)
Helper to compare two comparable types.
Definition: Integral.h:32
clang::ast_matchers::attr
const internal::VariadicAllOfMatcher< Attr > attr
Matches attributes.
Definition: ASTMatchersInternal.cpp:1031
clang::AttributeCommonInfo::AS_ContextSensitiveKeyword
@ AS_ContextSensitiveKeyword
Context-sensitive version of a keyword attribute.
Definition: AttributeCommonInfo.h:50
clang::ParsedAttr::getMaxArgs
unsigned getMaxArgs() const
Definition: ParsedAttr.cpp:154
clang::AttributeCommonInfo::isStandardAttributeSyntax
bool isStandardAttributeSyntax() const
The attribute is spelled [[]] in either C or C++ mode, including standard attributes spelled with a k...
Definition: AttributeCommonInfo.h:179
clang::SourceRange::getEnd
SourceLocation getEnd() const
Definition: SourceLocation.h:220
clang::ASTContext
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Definition: ASTContext.h:209
clang::ParsedAttr::isParamExpr
bool isParamExpr(size_t N) const
Definition: ParsedAttr.cpp:262
clang::AttributeCommonInfo::getSyntax
Syntax getSyntax() const
Definition: AttributeCommonInfo.h:130
clang::ParsedAttrInfo::NumArgs
unsigned NumArgs
The number of required arguments of this attribute.
Definition: ParsedAttr.h:48
clang::ParsedAttrInfo::getAllBuiltin
static ArrayRef< const ParsedAttrInfo * > getAllBuiltin()
Definition: ParsedAttr.cpp:148
clang::ParsedAttrInfo::IsType
unsigned IsType
True if this attribute applies to types.
Definition: ParsedAttr.h:60
IdentifierTable.h
clang::ParsedAttr
ParsedAttr - Represents a syntactic attribute.
Definition: ParsedAttr.h:233
checkAttributeNumArgsImpl
static bool checkAttributeNumArgsImpl(Sema &S, const ParsedAttr &AL, unsigned Num, unsigned Diag, Compare Comp)
Definition: ParsedAttr.cpp:276
clang::ParsedAttr::isTypeAttr
bool isTypeAttr() const
Definition: ParsedAttr.cpp:201
ASTContext.h
AttrSubjectMatchRules.h
clang::AttributeFactory::AttributeFactory
AttributeFactory()
Definition: ParsedAttr.cpp:54
clang::ParsedAttr::handleAttrWithDelayedArgs
void handleAttrWithDelayedArgs(Sema &S, Decl *D) const
Definition: ParsedAttr.cpp:266
clang::ParsedAttrInfo::get
static const ParsedAttrInfo & get(const AttributeCommonInfo &A)
Definition: ParsedAttr.cpp:112
clang::ParsedType
OpaquePtr< QualType > ParsedType
An opaque type for threading parsed type information through the parser.
Definition: Ownership.h:243
clang::ParsedAttr::slidesFromDeclToDeclSpecLegacyBehavior
bool slidesFromDeclToDeclSpecLegacyBehavior() const
Returns whether a [[]] attribute, if specified ahead of a declaration, should be applied to the decl-...
Definition: ParsedAttr.cpp:215
clang::ParsedAttrInfo::IsSupportedByPragmaAttribute
unsigned IsSupportedByPragmaAttribute
True if this attribute is supported by #pragma clang attribute.
Definition: ParsedAttr.h:66
clang::ParsedAttr::existsInTarget
bool existsInTarget(const TargetInfo &Target) const
Definition: ParsedAttr.cpp:205
clang::ParsedAttributesView::Range
SourceRange Range
Definition: ParsedAttr.h:925
clang::ParsedAttr::isKnownToGCC
bool isKnownToGCC() const
Definition: ParsedAttr.cpp:209
clang::ParsedAttr::hasVariadicArg
bool hasVariadicArg() const
Definition: ParsedAttr.cpp:254
clang::ParsedAttr::checkAtMostNumArgs
bool checkAtMostNumArgs(class Sema &S, unsigned Num) const
Check if the attribute has at most as many args as Num.
Definition: ParsedAttr.cpp:296
clang::ParsedAttr::diagnoseMutualExclusion
bool diagnoseMutualExclusion(class Sema &S, const Decl *D) const
Definition: ParsedAttr.cpp:174
clang::serialized_diags::create
std::unique_ptr< DiagnosticConsumer > create(StringRef OutputFile, DiagnosticOptions *Diags, bool MergeChildRecords=false)
Returns a DiagnosticConsumer that serializes diagnostics to a bitcode file.
Definition: SerializedDiagnosticPrinter.cpp:301
getFreeListIndexForSize
static size_t getFreeListIndexForSize(size_t size)
Definition: ParsedAttr.cpp:60
clang::ParsedAttr::hasParsedType
bool hasParsedType() const
Definition: ParsedAttr.h:457
llvm::ArrayRef
Definition: LLVM.h:34
clang::Decl
Decl - This represents one declaration (or definition), e.g.
Definition: DeclBase.h:83
clang::AttributeCommonInfo
Definition: AttributeCommonInfo.h:22
clang::ParsedAttr::isStmtAttr
bool isStmtAttr() const
Definition: ParsedAttr.cpp:203
clang::Sema
Sema - This implements semantic analysis and AST building for C.
Definition: Sema.h:358
clang::ParsedAttributes
ParsedAttributes - A collection of parsed attributes.
Definition: ParsedAttr.h:1023
clang::detail::PropertyData
Definition: ParsedAttr.h:201
clang::AttributeCommonInfo::getNormalizedFullName
std::string getNormalizedFullName() const
Gets the normalized full name, which consists of both scope and name and with surrounding underscores...
Definition: Attributes.cpp:117
clang::ParsedAttr::diagnoseAppertainsTo
bool diagnoseAppertainsTo(class Sema &S, const Decl *D) const
Definition: ParsedAttr.cpp:166
clang::ParsedAttr::getInfo
const ParsedAttrInfo & getInfo() const
Definition: ParsedAttr.h:729
clang::AttributeCommonInfo::IgnoredAttribute
@ IgnoredAttribute
Definition: AttributeCommonInfo.h:60
clang::IdentifierInfo
One of these records is kept for each identifier that is lexed.
Definition: IdentifierTable.h:85
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:81
clang::ParsedAttrInfoRegistry
llvm::Registry< ParsedAttrInfo > ParsedAttrInfoRegistry
Definition: ParsedAttr.h:155
clang::ParsedAttr::acceptsExprPack
bool acceptsExprPack() const
Definition: ParsedAttr.cpp:248
clang::AttributeFactory::AvailabilityAllocSize
@ AvailabilityAllocSize
Definition: ParsedAttr.h:741
clang
Definition: CalledOnceCheck.h:17
memset
__DEVICE__ void * memset(void *__a, int __b, size_t __c)
Definition: __clang_cuda_device_functions.h:1552
clang::ParsedAttr::hasCustomParsing
bool hasCustomParsing() const
Definition: ParsedAttr.cpp:162
clang::ParsedAttrInfo::HasCustomParsing
unsigned HasCustomParsing
True if the parsing does not match the semantic content.
Definition: ParsedAttr.h:54
clang::AttributeFactory::TypeTagForDatatypeAllocSize
@ TypeTagForDatatypeAllocSize
Definition: ParsedAttr.h:745
clang::Stmt
Stmt - This represents one statement.
Definition: Stmt.h:71
clang::ParsedAttr::diagnoseLangOpts
bool diagnoseLangOpts(class Sema &S) const
Definition: ParsedAttr.cpp:190
clang::ParsedAttrInfo::IsStmt
unsigned IsStmt
True if this attribute applies to statements.
Definition: ParsedAttr.h:62
clang::AttributeFactory::~AttributeFactory
~AttributeFactory()
clang::ParsedAttr::getMatchRules
void getMatchRules(const LangOptions &LangOpts, SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &MatchRules) const
Definition: ParsedAttr.cpp:183
clang::SourceLocation::isValid
bool isValid() const
Return true if this is a valid SourceLocation object.
Definition: SourceLocation.h:110
clang::Attr
Attr - This represents one attribute.
Definition: Attr.h:40
llvm::SmallVectorImpl
Definition: Randstruct.h:18
ParsedAttr.h
clang::IdentifierLoc
Wraps an identifier and optional source location for the identifier.
Definition: ParsedAttr.h:211
clang::ParsedAttrInfo::diagMutualExclusion
virtual bool diagMutualExclusion(Sema &S, const ParsedAttr &A, const Decl *D) const
Check if the given attribute is mutually exclusive with other attributes already applied to the given...
Definition: ParsedAttr.h:113
clang::ParsedAttr::isSupportedByPragmaAttribute
bool isSupportedByPragmaAttribute() const
Definition: ParsedAttr.cpp:211
clang::takeAndConcatenateAttrs
void takeAndConcatenateAttrs(ParsedAttributes &First, ParsedAttributes &Second, ParsedAttributes &Result)
Consumes the attributes from First and Second and concatenates them into Result.
Definition: ParsedAttr.cpp:302
clang::ParsedAttrInfo::existsInTarget
virtual bool existsInTarget(const TargetInfo &Target) const
Check if this attribute is allowed when compiling for the given target.
Definition: ParsedAttr.h:121
clang::ParsedAttrInfo::AcceptsExprPack
unsigned AcceptsExprPack
Definition: ParsedAttr.h:56
clang::ParsedAttrInfo::getPragmaAttributeMatchRules
virtual void getPragmaAttributeMatchRules(llvm::SmallVectorImpl< std::pair< attr::SubjectMatchRule, bool >> &Rules, const LangOptions &LangOpts) const
Populate Rules with the match rules of this attribute.
Definition: ParsedAttr.h:134