14 #ifndef LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H 15 #define LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H 41 enum { BufferMaxAlignment =
alignof(
void *) };
42 alignas(BufferMaxAlignment)
char InlineBuffer[InlineCapacity];
43 unsigned NumBytesAtAlign4, NumBytesAtAlign8;
47 : Buffer(InlineBuffer), Capacity(InlineCapacity), Index(InlineCapacity),
48 NumBytesAtAlign4(0), NumBytesAtAlign8(0) {}
51 if (Buffer != InlineBuffer)
57 if (Requested > Capacity)
80 NumBytesAtAlign4 = NumBytesAtAlign8 = 0;
95 size_t LocalSize = Loc.getLocalDataSize();
96 unsigned LocalAlign = Loc.getLocalDataAlignment();
97 return pushImpl(T, LocalSize, LocalAlign).
castAs<TyLocType>();
103 assert(T == LastTy &&
"type doesn't match last type pushed!");
106 size_t FullDataSize = Capacity - Index;
116 assert(T == LastTy &&
"type doesn't match last type pushed!");
119 size_t FullDataSize = Capacity - Index;
120 void *Mem = Context.
Allocate(FullDataSize);
121 memcpy(Mem, &Buffer[Index], FullDataSize);
127 TypeLoc pushImpl(
QualType T,
size_t LocalSize,
unsigned LocalAlignment);
130 void grow(
size_t NewCapacity);
140 assert(LastTy == T &&
"type doesn't match last type pushed!");
142 return TypeLoc(T, &Buffer[Index]);
Defines the clang::ASTContext interface.
A (possibly-)qualified type.
A container of type source information.
A reasonable base class for TypeLocs that correspond to types that are written as a type-specifier...
Base wrapper for a particular "section" of type source info.
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
TypeSpecTypeLoc pushTypeSpec(QualType T)
Pushes space for a typespec TypeLoc.
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void * getOpaqueData() const
Get the pointer where source information is stored.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
Defines the clang::TypeLoc interface and its subclasses.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
void clear()
Resets this builder to the newly-initialized state.
Encodes a location in the source.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
void * Allocate(size_t Size, unsigned Align=8) const
Dataflow Directional Tag Classes.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.