18 #include "llvm/Support/DJB.h"
20 using namespace clang;
29 case BuiltinType::Void:
32 case BuiltinType::Bool:
35 case BuiltinType::Char_U:
38 case BuiltinType::UChar:
41 case BuiltinType::UShort:
44 case BuiltinType::UInt:
47 case BuiltinType::ULong:
50 case BuiltinType::ULongLong:
53 case BuiltinType::UInt128:
56 case BuiltinType::Char_S:
59 case BuiltinType::SChar:
62 case BuiltinType::WChar_S:
63 case BuiltinType::WChar_U:
66 case BuiltinType::Short:
69 case BuiltinType::Int:
72 case BuiltinType::Long:
75 case BuiltinType::LongLong:
78 case BuiltinType::Int128:
81 case BuiltinType::Half:
87 case BuiltinType::Double:
90 case BuiltinType::LongDouble:
93 case BuiltinType::ShortAccum:
96 case BuiltinType::Accum:
99 case BuiltinType::LongAccum:
102 case BuiltinType::UShortAccum:
105 case BuiltinType::UAccum:
108 case BuiltinType::ULongAccum:
111 case BuiltinType::ShortFract:
114 case BuiltinType::Fract:
117 case BuiltinType::LongFract:
120 case BuiltinType::UShortFract:
123 case BuiltinType::UFract:
126 case BuiltinType::ULongFract:
129 case BuiltinType::SatShortAccum:
132 case BuiltinType::SatAccum:
135 case BuiltinType::SatLongAccum:
138 case BuiltinType::SatUShortAccum:
141 case BuiltinType::SatUAccum:
144 case BuiltinType::SatULongAccum:
147 case BuiltinType::SatShortFract:
150 case BuiltinType::SatFract:
153 case BuiltinType::SatLongFract:
156 case BuiltinType::SatUShortFract:
159 case BuiltinType::SatUFract:
162 case BuiltinType::SatULongFract:
165 case BuiltinType::Float16:
168 case BuiltinType::Float128:
171 case BuiltinType::Ibm128:
174 case BuiltinType::NullPtr:
177 case BuiltinType::Char8:
180 case BuiltinType::Char16:
183 case BuiltinType::Char32:
186 case BuiltinType::Overload:
189 case BuiltinType::UnresolvedTemplate:
192 case BuiltinType::BoundMember:
195 case BuiltinType::PseudoObject:
198 case BuiltinType::Dependent:
201 case BuiltinType::UnknownAny:
204 case BuiltinType::ARCUnbridgedCast:
207 case BuiltinType::ObjCId:
210 case BuiltinType::ObjCClass:
213 case BuiltinType::ObjCSel:
216 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
217 case BuiltinType::Id: \
218 ID = PREDEF_TYPE_##Id##_ID; \
220 #include "clang/Basic/OpenCLImageTypes.def"
221 #define IMAGE_TYPE(ImgType, Id, SingletonId, Access, Suffix) \
222 case BuiltinType::Sampled##Id: \
223 ID = PREDEF_TYPE_SAMPLED_##Id##_ID; \
225 #define IMAGE_WRITE_TYPE(Type, Id, Ext)
226 #define IMAGE_READ_WRITE_TYPE(Type, Id, Ext)
227 #include "clang/Basic/OpenCLImageTypes.def"
228 #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \
229 case BuiltinType::Id: \
230 ID = PREDEF_TYPE_##Id##_ID; \
232 #include "clang/Basic/OpenCLExtensionTypes.def"
233 case BuiltinType::OCLSampler:
236 case BuiltinType::OCLEvent:
239 case BuiltinType::OCLClkEvent:
242 case BuiltinType::OCLQueue:
245 case BuiltinType::OCLReserveID:
248 #define SVE_TYPE(Name, Id, SingletonId) \
249 case BuiltinType::Id: \
250 ID = PREDEF_TYPE_##Id##_ID; \
252 #include "clang/Basic/AArch64SVEACLETypes.def"
253 #define PPC_VECTOR_TYPE(Name, Id, Size) \
254 case BuiltinType::Id: \
255 ID = PREDEF_TYPE_##Id##_ID; \
257 #include "clang/Basic/PPCTypes.def"
258 #define RVV_TYPE(Name, Id, SingletonId) \
259 case BuiltinType::Id: \
260 ID = PREDEF_TYPE_##Id##_ID; \
262 #include "clang/Basic/RISCVVTypes.def"
263 #define WASM_TYPE(Name, Id, SingletonId) \
264 case BuiltinType::Id: \
265 ID = PREDEF_TYPE_##Id##_ID; \
267 #include "clang/Basic/WebAssemblyReferenceTypes.def"
268 case BuiltinType::BuiltinFn:
271 case BuiltinType::IncompleteMatrixIdx:
274 case BuiltinType::ArraySection:
277 case BuiltinType::OMPArrayShaping:
280 case BuiltinType::OMPIterator:
283 case BuiltinType::BFloat16:
296 for (
unsigned I = 0; I != N; ++I)
298 R = llvm::djbHash(II->getName(), R);
306 case Decl::TranslationUnit:
307 case Decl::ExternCContext:
308 case Decl::Namespace:
309 case Decl::LinkageSpec:
322 case Decl::CXXRecord:
323 case Decl::ClassTemplateSpecialization:
324 case Decl::ClassTemplatePartialSpecialization:
329 case Decl::CXXMethod:
330 case Decl::CXXConstructor:
331 case Decl::CXXDestructor:
332 case Decl::CXXConversion:
333 case Decl::ObjCMethod:
338 case Decl::ObjCCategory:
339 case Decl::ObjCCategoryImpl:
340 case Decl::ObjCImplementation:
343 case Decl::ObjCProtocol:
352 case Decl::ObjCInterface:
356 llvm_unreachable(
"Unhandled DeclContext in AST reader");
359 llvm_unreachable(
"Unhandled decl kind");
364 case Decl::TranslationUnit:
365 case Decl::ExternCContext:
369 case Decl::Namespace:
370 case Decl::NamespaceAlias:
372 case Decl::TypeAlias:
375 case Decl::CXXRecord:
376 case Decl::ClassTemplateSpecialization:
377 case Decl::ClassTemplatePartialSpecialization:
378 case Decl::VarTemplateSpecialization:
379 case Decl::VarTemplatePartialSpecialization:
381 case Decl::CXXDeductionGuide:
382 case Decl::CXXMethod:
383 case Decl::CXXConstructor:
384 case Decl::CXXDestructor:
385 case Decl::CXXConversion:
386 case Decl::UsingShadow:
387 case Decl::ConstructorUsingShadow:
389 case Decl::FunctionTemplate:
390 case Decl::ClassTemplate:
391 case Decl::VarTemplate:
392 case Decl::TypeAliasTemplate:
393 case Decl::ObjCProtocol:
394 case Decl::ObjCInterface:
399 case Decl::UsingDirective:
401 case Decl::UnresolvedUsingTypename:
402 case Decl::TemplateTypeParm:
403 case Decl::EnumConstant:
404 case Decl::UnresolvedUsingValue:
405 case Decl::IndirectField:
407 case Decl::MSProperty:
409 case Decl::UnnamedGlobalConstant:
410 case Decl::TemplateParamObject:
412 case Decl::ObjCAtDefsField:
413 case Decl::NonTypeTemplateParm:
414 case Decl::TemplateTemplateParm:
416 case Decl::UsingEnum:
417 case Decl::UsingPack:
418 case Decl::ObjCMethod:
419 case Decl::ObjCCategory:
420 case Decl::ObjCCategoryImpl:
421 case Decl::ObjCImplementation:
422 case Decl::ObjCProperty:
423 case Decl::ObjCCompatibleAlias:
424 case Decl::LinkageSpec:
426 case Decl::ObjCPropertyImpl:
427 case Decl::PragmaComment:
428 case Decl::PragmaDetectMismatch:
429 case Decl::FileScopeAsm:
430 case Decl::TopLevelStmt:
431 case Decl::AccessSpec:
433 case Decl::FriendTemplate:
434 case Decl::StaticAssert:
438 case Decl::OMPThreadPrivate:
439 case Decl::OMPAllocate:
440 case Decl::OMPRequires:
441 case Decl::OMPCapturedExpr:
442 case Decl::OMPDeclareReduction:
443 case Decl::OMPDeclareMapper:
444 case Decl::BuiltinTemplate:
445 case Decl::Decomposition:
448 case Decl::ImplicitConceptSpecialization:
449 case Decl::LifetimeExtendedTemporary:
450 case Decl::RequiresExprBody:
451 case Decl::UnresolvedUsingIfExists:
452 case Decl::HLSLBuffer:
457 case Decl::ImplicitParam:
459 case Decl::ObjCTypeParam:
463 llvm_unreachable(
"Unhandled declaration kind");
477 if (
auto *FD = dyn_cast<FunctionDecl>(D))
478 return !FD->getDescribedFunctionTemplate();
479 if (
auto *RD = dyn_cast<CXXRecordDecl>(D))
480 return !RD->getDescribedClassTemplate();
489 if (
auto *VD = dyn_cast<VarDecl>(D))
490 return VD->isStaticLocal();
492 return isa<TagDecl, BlockDecl>(D);
501 return isa<TagDecl, FieldDecl>(D);
Defines the C++ Decl subclasses, other than those for templates (found in DeclTemplate....
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
llvm::MachO::Record Record
static const NamedDecl * getDefinition(const Decl *D)
virtual ~ASTDeserializationListener()
This class is used for builtin types like 'int'.
DeclContext - This is used only as base class of specific decl types that can act as declaration cont...
bool isDependentContext() const
Determines whether this context is dependent on a template parameter.
bool isFunctionOrMethod() const
Decl::Kind getDeclKind() const
FriendObjectKind getFriendObjectKind() const
Determines whether this declaration is the object of a friend declaration and, if so,...
Kind
Lists the kind of concrete classes of Decl.
DeclContext * getLexicalDeclContext()
getLexicalDeclContext - The declaration context where this Decl was lexically declared (LexicalDC).
One of these records is kept for each identifier that is lexed.
This represents a decl that may have a name.
DeclarationName getDeclName() const
Get the actual, stored name of the declaration, which may be a special name.
Represents an Objective-C protocol declaration.
Smart pointer class that efficiently represents Objective-C method names.
const IdentifierInfo * getIdentifierInfoForSlot(unsigned argIndex) const
Retrieve the identifier at a given position in the selector.
unsigned getNumArgs() const
Represents the declaration of a struct/union/class/enum.
A type index; the type ID with the qualifier bits removed.
@ PREDEF_TYPE_LONG_ACCUM_ID
The 'long _Accum' type.
@ PREDEF_TYPE_SAMPLER_ID
OpenCL sampler type.
@ PREDEF_TYPE_INT128_ID
The '__int128_t' type.
@ PREDEF_TYPE_CHAR32_ID
The C++ 'char32_t' type.
@ PREDEF_TYPE_SAT_SHORT_ACCUM_ID
The '_Sat short _Accum' type.
@ PREDEF_TYPE_IBM128_ID
The '__ibm128' type.
@ PREDEF_TYPE_SHORT_FRACT_ID
The 'short _Fract' type.
@ PREDEF_TYPE_BOUND_MEMBER
The placeholder type for bound member functions.
@ PREDEF_TYPE_LONGLONG_ID
The (signed) 'long long' type.
@ PREDEF_TYPE_FRACT_ID
The '_Fract' type.
@ PREDEF_TYPE_ARC_UNBRIDGED_CAST
ARC's unbridged-cast placeholder type.
@ PREDEF_TYPE_USHORT_FRACT_ID
The 'unsigned short _Fract' type.
@ PREDEF_TYPE_SAT_ULONG_FRACT_ID
The '_Sat unsigned long _Fract' type.
@ PREDEF_TYPE_BOOL_ID
The 'bool' or '_Bool' type.
@ PREDEF_TYPE_SAT_LONG_ACCUM_ID
The '_Sat long _Accum' type.
@ PREDEF_TYPE_SAT_LONG_FRACT_ID
The '_Sat long _Fract' type.
@ PREDEF_TYPE_SAT_SHORT_FRACT_ID
The '_Sat short _Fract' type.
@ PREDEF_TYPE_CHAR_U_ID
The 'char' type, when it is unsigned.
@ PREDEF_TYPE_RESERVE_ID_ID
OpenCL reserve_id type.
@ PREDEF_TYPE_SAT_ACCUM_ID
The '_Sat _Accum' type.
@ PREDEF_TYPE_BUILTIN_FN
The placeholder type for builtin functions.
@ PREDEF_TYPE_SHORT_ACCUM_ID
The 'short _Accum' type.
@ PREDEF_TYPE_FLOAT_ID
The 'float' type.
@ PREDEF_TYPE_QUEUE_ID
OpenCL queue type.
@ PREDEF_TYPE_INT_ID
The (signed) 'int' type.
@ PREDEF_TYPE_OBJC_SEL
The ObjC 'SEL' type.
@ PREDEF_TYPE_BFLOAT16_ID
The '__bf16' type.
@ PREDEF_TYPE_WCHAR_ID
The C++ 'wchar_t' type.
@ PREDEF_TYPE_UCHAR_ID
The 'unsigned char' type.
@ PREDEF_TYPE_UACCUM_ID
The 'unsigned _Accum' type.
@ PREDEF_TYPE_SCHAR_ID
The 'signed char' type.
@ PREDEF_TYPE_CHAR_S_ID
The 'char' type, when it is signed.
@ PREDEF_TYPE_NULLPTR_ID
The type of 'nullptr'.
@ PREDEF_TYPE_ULONG_FRACT_ID
The 'unsigned long _Fract' type.
@ PREDEF_TYPE_FLOAT16_ID
The '_Float16' type.
@ PREDEF_TYPE_UINT_ID
The 'unsigned int' type.
@ PREDEF_TYPE_FLOAT128_ID
The '__float128' type.
@ PREDEF_TYPE_OBJC_ID
The ObjC 'id' type.
@ PREDEF_TYPE_CHAR16_ID
The C++ 'char16_t' type.
@ PREDEF_TYPE_ARRAY_SECTION
The placeholder type for an array section.
@ PREDEF_TYPE_ULONGLONG_ID
The 'unsigned long long' type.
@ PREDEF_TYPE_SAT_UFRACT_ID
The '_Sat unsigned _Fract' type.
@ PREDEF_TYPE_USHORT_ID
The 'unsigned short' type.
@ PREDEF_TYPE_SHORT_ID
The (signed) 'short' type.
@ PREDEF_TYPE_OMP_ARRAY_SHAPING
The placeholder type for OpenMP array shaping operation.
@ PREDEF_TYPE_DEPENDENT_ID
The placeholder type for dependent types.
@ PREDEF_TYPE_LONGDOUBLE_ID
The 'long double' type.
@ PREDEF_TYPE_DOUBLE_ID
The 'double' type.
@ PREDEF_TYPE_UINT128_ID
The '__uint128_t' type.
@ PREDEF_TYPE_HALF_ID
The OpenCL 'half' / ARM NEON __fp16 type.
@ PREDEF_TYPE_VOID_ID
The void type.
@ PREDEF_TYPE_SAT_USHORT_FRACT_ID
The '_Sat unsigned short _Fract' type.
@ PREDEF_TYPE_ACCUM_ID
The '_Accum' type.
@ PREDEF_TYPE_SAT_FRACT_ID
The '_Sat _Fract' type.
@ PREDEF_TYPE_USHORT_ACCUM_ID
The 'unsigned short _Accum' type.
@ PREDEF_TYPE_CHAR8_ID
The C++ 'char8_t' type.
@ PREDEF_TYPE_UFRACT_ID
The 'unsigned _Fract' type.
@ PREDEF_TYPE_OVERLOAD_ID
The placeholder type for overloaded function sets.
@ PREDEF_TYPE_INCOMPLETE_MATRIX_IDX
A placeholder type for incomplete matrix index operations.
@ PREDEF_TYPE_UNRESOLVED_TEMPLATE
The placeholder type for unresolved templates.
@ PREDEF_TYPE_SAT_USHORT_ACCUM_ID
The '_Sat unsigned short _Accum' type.
@ PREDEF_TYPE_LONG_ID
The (signed) 'long' type.
@ PREDEF_TYPE_SAT_ULONG_ACCUM_ID
The '_Sat unsigned long _Accum' type.
@ PREDEF_TYPE_LONG_FRACT_ID
The 'long _Fract' type.
@ PREDEF_TYPE_UNKNOWN_ANY
The 'unknown any' placeholder type.
@ PREDEF_TYPE_OMP_ITERATOR
The placeholder type for OpenMP iterator expression.
@ PREDEF_TYPE_PSEUDO_OBJECT
The pseudo-object placeholder type.
@ PREDEF_TYPE_OBJC_CLASS
The ObjC 'Class' type.
@ PREDEF_TYPE_ULONG_ID
The 'unsigned long' type.
@ PREDEF_TYPE_SAT_UACCUM_ID
The '_Sat unsigned _Accum' type.
@ PREDEF_TYPE_CLK_EVENT_ID
OpenCL clk event type.
@ PREDEF_TYPE_EVENT_ID
OpenCL event type.
@ PREDEF_TYPE_ULONG_ACCUM_ID
The 'unsigned long _Accum' type.
bool isRedeclarableDeclKind(unsigned Kind)
Determine whether the given declaration kind is redeclarable.
TypeIdx TypeIdxFromBuiltin(const BuiltinType *BT)
bool needsAnonymousDeclarationNumber(const NamedDecl *D)
Determine whether the given declaration needs an anonymous declaration number.
const DeclContext * getDefinitiveDeclContext(const DeclContext *DC)
Retrieve the "definitive" declaration that provides all of the visible entries for the given declarat...
unsigned ComputeHash(Selector Sel)
The JSON file list parser is used to communicate input to InstallAPI.