9#ifndef LLVM_CLANG_AST_ABSTRACTBASICREADER_H
10#define LLVM_CLANG_AST_ABSTRACTBASICREADER_H
16namespace serialization {
20 return (value ? *value :
T());
24 return value.value_or(
nullptr);
101#include "clang/AST/AbstractBasicReader.inc"
133 Impl &
find(
const char *propertyName) {
139 return T(asImpl().readUInt32());
147 assert(buffer.empty());
149 uint32_t size = asImpl().readUInt32();
150 buffer.reserve(size);
152 for (uint32_t i = 0; i != size; ++i) {
153 buffer.push_back(ReadDispatcher<T>::read(asImpl()));
158 template <
class T,
class... Args>
160 return UnpackOptionalValue<T>::unpack(
161 ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
166 llvm::APInt value = asImpl().readAPInt();
167 return llvm::APSInt(std::move(value),
isUnsigned);
171 unsigned bitWidth = asImpl().readUInt32();
172 unsigned numWords = llvm::APInt::getNumWords(bitWidth);
174 for (uint32_t i = 0; i != numWords; ++i)
175 data.push_back(asImpl().readUInt64());
176 return llvm::APInt(bitWidth, numWords, &data[0]);
180 unsigned width = asImpl().readUInt32();
181 unsigned scale = asImpl().readUInt32();
182 unsigned tmp = asImpl().readUInt32();
183 bool isSigned = tmp & 0x1;
184 bool isSaturated = tmp & 0x2;
185 bool hasUnsignedPadding = tmp & 0x4;
186 return llvm::FixedPointSemantics(width, scale, isSigned, isSaturated,
192 auto origTy = asImpl().readQualType();
193 auto elemTy = origTy;
194 unsigned pathLength = asImpl().readUInt32();
195 for (
unsigned i = 0; i < pathLength; ++i) {
196 if (elemTy->isRecordType()) {
197 unsigned int_ = asImpl().readUInt32();
198 Decl *
decl = asImpl().template readDeclAs<Decl>();
200 elemTy = getASTContext().getCanonicalTagType(
recordDecl);
202 elemTy = cast<ValueDecl>(
decl)->getType();
206 elemTy = getASTContext().getAsArrayType(elemTy)->getElementType();
216 "update this if the value size changes");
217 uint64_t value = asImpl().readUInt64();
226 esi.
Exceptions = asImpl().template readArray<QualType>(buffer);
230 esi.
SourceDecl = asImpl().readFunctionDeclRef();
233 esi.
SourceDecl = asImpl().readFunctionDeclRef();
241 "opaque value doesn't fit into uint32_t");
242 uint32_t value = asImpl().readUInt32();
243 return FunctionProtoType::ExtParameterInfo::getFromOpaqueValue(value);
247 uint32_t value = asImpl().readUInt32();
256 auto &ctx = getASTContext();
261 uint32_t depth = asImpl().readUInt32();
262 for (uint32_t i = 0; i != depth; ++i) {
263 auto kind = asImpl().readNestedNameSpecifierKind();
282 llvm_unreachable(
"unexpected null nested name specifier");
284 llvm_unreachable(
"bad nested name specifier kind");
static bool isUnsigned(SValBuilder &SVB, NonLoc Value)
Defines the C++ template declaration subclasses.
A non-discriminated union of a base, field, or array index.
static LValuePathEntry ArrayIndex(uint64_t Index)
llvm::PointerIntPair< const Decl *, 1, bool > BaseOrMemberType
A FieldDecl or CXXRecordDecl, along with a flag indicating whether we mean a virtual or non-virtual b...
Holds long-lived AST nodes (such as types and decls) that can be referred to throughout the semantic ...
Decl - This represents one declaration (or definition), e.g.
Wrap a function effect's condition expression in another struct so that FunctionProtoType's TrailingO...
Represents an abstract function effect, using just an enumeration describing its kind.
static FunctionEffect fromOpaqueInt32(uint32_t Value)
Interesting information about a specific parameter that can't simply be reflected in parameter's type...
unsigned char getOpaqueValue() const
Represents a C++ nested name specifier, such as "\::std::vector<int>::".
static constexpr NestedNameSpecifier getGlobal()
@ MicrosoftSuper
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Global
The global specifier '::'. There is no stored value.
@ Type
A type, stored as a Type*.
@ Namespace
A namespace-like entity, stored as a NamespaceBaseDecl*.
The collection of all-type qualifiers we support.
uint64_t getAsOpaqueValue() const
static Qualifiers fromOpaqueValue(uint64_t opaque)
DataStreamBasicReader provides convenience implementations for many BasicReader methods based on the ...
FunctionProtoType::ExceptionSpecInfo readExceptionSpecInfo(llvm::SmallVectorImpl< QualType > &buffer)
FunctionProtoType::ExtParameterInfo readExtParameterInfo()
NestedNameSpecifier readNestedNameSpecifier()
APValue::LValuePathSerializationHelper readLValuePathSerializationHelper(SmallVectorImpl< APValue::LValuePathEntry > &path)
llvm::APSInt readAPSInt()
DataStreamBasicReader(ASTContext &ctx)
EffectConditionExpr readEffectConditionExpr()
Qualifiers readQualifiers()
FunctionEffect readFunctionEffect()
std::optional< T > readOptional(Args &&...args)
ArrayRef< T > readArray(llvm::SmallVectorImpl< T > &buffer)
Impl & find(const char *propertyName)
Implement property-find by ignoring it.
llvm::FixedPointSemantics readFixedPointSemantics()
const internal::VariadicAllOfMatcher< Decl > decl
Matches declarations.
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
T * makePointerFromOptional(std::optional< T * > value)
T makeNullableFromOptional(const std::optional< T > &value)
The JSON file list parser is used to communicate input to InstallAPI.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
const FunctionProtoType * T
ExceptionSpecificationType
The various types of exception specifications that exist in C++11.
@ EST_Uninstantiated
not instantiated yet
@ EST_Unevaluated
not evaluated yet, for special member function
@ EST_Dynamic
throw(T1, T2)
Holds information about the various types of exception specification.
FunctionDecl * SourceDecl
The function whose exception specification this is, for EST_Unevaluated and EST_Uninstantiated.
FunctionDecl * SourceTemplate
The function template whose exception specification this is instantiated from, for EST_Uninstantiated...
ExceptionSpecificationType Type
The kind of exception specification this is.
ArrayRef< QualType > Exceptions
Explicitly-specified list of exception types.
Expr * NoexceptExpr
Noexcept expression, if this is a computed noexcept specification.