14 #ifndef LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H 15 #define LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H 41 enum { BufferMaxAlignment =
alignof(
void *) };
42 llvm::AlignedCharArray<BufferMaxAlignment, InlineCapacity> InlineBuffer;
43 unsigned NumBytesAtAlign4, NumBytesAtAlign8;
47 : Buffer(InlineBuffer.buffer), Capacity(InlineCapacity),
48 Index(InlineCapacity), NumBytesAtAlign4(0), NumBytesAtAlign8(0)
53 if (Buffer != InlineBuffer.buffer)
59 if (Requested > Capacity)
82 NumBytesAtAlign4 = NumBytesAtAlign8 = 0;
97 size_t LocalSize = Loc.getLocalDataSize();
98 unsigned LocalAlign = Loc.getLocalDataAlignment();
99 return pushImpl(T, LocalSize, LocalAlign).
castAs<TyLocType>();
105 assert(T == LastTy &&
"type doesn't match last type pushed!");
108 size_t FullDataSize = Capacity - Index;
118 assert(T == LastTy &&
"type doesn't match last type pushed!");
121 size_t FullDataSize = Capacity - Index;
122 void *Mem = Context.
Allocate(FullDataSize);
123 memcpy(Mem, &Buffer[Index], FullDataSize);
129 TypeLoc pushImpl(
QualType T,
size_t LocalSize,
unsigned LocalAlignment);
132 void grow(
size_t NewCapacity);
142 assert(LastTy == T &&
"type doesn't match last type pushed!");
144 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.