15 #ifndef LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H
16 #define LLVM_CLANG_LIB_SEMA_TYPELOCBUILDER_H
42 enum { BufferMaxAlignment = llvm::AlignOf<void*>::Alignment };
43 llvm::AlignedCharArray<BufferMaxAlignment, InlineCapacity> InlineBuffer;
44 unsigned NumBytesAtAlign4, NumBytesAtAlign8;
48 : Buffer(InlineBuffer.buffer), Capacity(InlineCapacity),
49 Index(InlineCapacity), NumBytesAtAlign4(0), NumBytesAtAlign8(0)
54 if (Buffer != InlineBuffer.buffer)
60 if (Requested > Capacity)
83 NumBytesAtAlign4 = NumBytesAtAlign8 = 0;
98 size_t LocalSize = Loc.getLocalDataSize();
99 unsigned LocalAlign = Loc.getLocalDataAlignment();
100 return pushImpl(T, LocalSize, LocalAlign).
castAs<TyLocType>();
106 assert(T == LastTy &&
"type doesn't match last type pushed!");
109 size_t FullDataSize = Capacity - Index;
119 assert(T == LastTy &&
"type doesn't match last type pushed!");
122 size_t FullDataSize = Capacity - Index;
123 void *Mem = Context.
Allocate(FullDataSize);
124 memcpy(Mem, &Buffer[Index], FullDataSize);
130 TypeLoc pushImpl(
QualType T,
size_t LocalSize,
unsigned LocalAlignment);
133 void grow(
size_t NewCapacity);
143 assert(LastTy == T &&
"type doesn't match last type pushed!");
145 return TypeLoc(T, &Buffer[Index]);
Defines the clang::ASTContext interface.
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.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type...
TypeSpecTypeLoc pushTypeSpec(QualType T)
TyLocType push(QualType T)
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
void * getOpaqueData() const
Get the pointer where source information is stored.
Defines the clang::TypeLoc interface and its subclasses.
TypeSourceInfo * CreateTypeSourceInfo(QualType T, unsigned Size=0) const
Allocate an uninitialized TypeSourceInfo.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
void clear()
Resets this builder to the newly-initialized state.
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
void * Allocate(size_t Size, unsigned Align=8) const
void pushFullCopy(TypeLoc L)