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;
48 : Buffer(InlineBuffer), Capacity(InlineCapacity), Index(InlineCapacity),
49 NumBytesAtAlign4(0), AtAlign8(
false) {}
52 if (Buffer != InlineBuffer)
61 if (Requested > Capacity)
104 size_t LocalSize =
Loc.getLocalDataSize();
105 unsigned LocalAlign =
Loc.getLocalDataAlignment();
106 return pushImpl(
T, LocalSize, LocalAlign).
castAs<TyLocType>();
112 assert(
T == LastTy &&
"type doesn't match last type pushed!");
115 size_t FullDataSize = Capacity - Index;
125 assert(
T == LastTy &&
"type doesn't match last type pushed!");
128 size_t FullDataSize = Capacity - Index;
129 void *Mem = Context.Allocate(FullDataSize);
130 memcpy(Mem, &Buffer[Index], FullDataSize);
139 void grow(
size_t NewCapacity);
149 assert(LastTy ==
T &&
"type doesn't match last type pushed!");
Defines the clang::ASTContext interface.
Defines the clang::TypeLoc interface and its subclasses.
__DEVICE__ void * memcpy(void *__a, const void *__b, size_t __c)
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
A (possibly-)qualified type.
Encodes a location in the source.
TypeLoc getTypeLocInContext(ASTContext &Context, QualType T)
Copies the type-location information to the given AST context and returns a TypeLoc referring into th...
TyLocType push(QualType T)
Pushes space for a new TypeLoc of the given type.
void clear()
Resets this builder to the newly-initialized state.
void pushFullCopy(TypeLoc L)
Pushes a copy of the given TypeLoc onto this builder.
void reserve(size_t Requested)
Ensures that this buffer has at least as much capacity as described.
TypeLocBuilder(const TypeLocBuilder &)=delete
TypeLocBuilder & operator=(const TypeLocBuilder &)=delete
TypeSpecTypeLoc pushTypeSpec(QualType T)
Pushes space for a typespec TypeLoc.
void TypeWasModifiedSafely(QualType T)
Tell the TypeLocBuilder that the type it is storing has been modified in some safe way that doesn't a...
TypeSourceInfo * getTypeSourceInfo(ASTContext &Context, QualType T)
Creates a TypeSourceInfo for the given type.
void pushTrivial(ASTContext &Context, QualType T, SourceLocation Loc)
Pushes 'T' with all locations pointing to 'Loc'.
Base wrapper for a particular "section" of type source info.
T castAs() const
Convert to the specified TypeLoc type, asserting that this TypeLoc is of the desired type.
void * getOpaqueData() const
Get the pointer where source information is stored.
A container of type source information.
TypeLoc getTypeLoc() const
Return the TypeLoc wrapper for the type source info.
A reasonable base class for TypeLocs that correspond to types that are written as a type-specifier.
The JSON file list parser is used to communicate input to InstallAPI.
const FunctionProtoType * T