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());
148 assert(buffer.empty());
150 uint32_t size = asImpl().readUInt32();
151 buffer.reserve(size);
153 for (uint32_t i = 0; i != size; ++i) {
154 buffer.push_back(ReadDispatcher<T>::read(asImpl()));
159 template <
class T,
class... Args>
161 return UnpackOptionalValue<T>::unpack(
162 ReadDispatcher<T>::read(asImpl(), std::forward<Args>(args)...));
167 llvm::APInt value = asImpl().readAPInt();
168 return llvm::APSInt(std::move(value),
isUnsigned);
172 unsigned bitWidth = asImpl().readUInt32();
173 unsigned numWords = llvm::APInt::getNumWords(bitWidth);
175 for (uint32_t i = 0; i != numWords; ++i)
176 data.push_back(asImpl().readUInt64());
177 return llvm::APInt(bitWidth, numWords, &data[0]);
181 unsigned width = asImpl().readUInt32();
182 unsigned scale = asImpl().readUInt32();
183 unsigned tmp = asImpl().readUInt32();
184 bool isSigned = tmp & 0x1;
185 bool isSaturated = tmp & 0x2;
186 bool hasUnsignedPadding = tmp & 0x4;
187 return llvm::FixedPointSemantics(width, scale, isSigned, isSaturated,
193 auto origTy = asImpl().readQualType();
194 auto elemTy = origTy;
195 unsigned pathLength = asImpl().readUInt32();
196 for (
unsigned i = 0; i < pathLength; ++i) {
197 if (elemTy->template getAs<RecordType>()) {
198 unsigned int_ = asImpl().readUInt32();
199 Decl *
decl = asImpl().template readDeclAs<Decl>();
201 elemTy = getASTContext().getRecordType(
recordDecl);
203 elemTy = cast<ValueDecl>(
decl)->getType();
207 elemTy = getASTContext().getAsArrayType(elemTy)->getElementType();
217 "update this if the value size changes");
218 uint64_t value = asImpl().readUInt64();
227 esi.
Exceptions = asImpl().template readArray<QualType>(buffer);
231 esi.
SourceDecl = asImpl().readFunctionDeclRef();
234 esi.
SourceDecl = asImpl().readFunctionDeclRef();
242 "opaque value doesn't fit into uint32_t");
243 uint32_t value = asImpl().readUInt32();
244 return FunctionProtoType::ExtParameterInfo::getFromOpaqueValue(value);
248 uint32_t value = asImpl().readUInt32();
257 auto &ctx = getASTContext();
262 uint32_t depth = asImpl().readUInt32();
263 for (uint32_t i = 0; i != depth; ++i) {
264 auto kind = asImpl().readNestedNameSpecifierKind();
268 asImpl().readIdentifier());
273 asImpl().readNamespaceDeclRef());
278 asImpl().readNamespaceAliasDeclRef());
285 asImpl().readQualType().getTypePtr());
294 asImpl().readCXXRecordDeclRef());
297 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 NestedNameSpecifier * Create(const ASTContext &Context, NestedNameSpecifier *Prefix, const IdentifierInfo *II)
Builds a specifier combining a prefix and an identifier.
static NestedNameSpecifier * GlobalSpecifier(const ASTContext &Context)
Returns the nested name specifier representing the global scope.
@ NamespaceAlias
A namespace alias, stored as a NamespaceAliasDecl*.
@ TypeSpec
A type, stored as a Type*.
@ TypeSpecWithTemplate
A type that was preceded by the 'template' keyword, stored as a Type*.
@ Super
Microsoft's '__super' specifier, stored as a CXXRecordDecl* of the class it appeared in.
@ Identifier
An identifier, stored as an IdentifierInfo*.
@ Global
The global specifier '::'. There is no stored value.
@ Namespace
A namespace, stored as a NamespaceDecl*.
static NestedNameSpecifier * SuperSpecifier(const ASTContext &Context, CXXRecordDecl *RD)
Returns the nested name specifier representing the __super scope for the given CXXRecordDecl.
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()
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)
llvm::ArrayRef< T > readArray(llvm::SmallVectorImpl< T > &buffer)
Impl & find(const char *propertyName)
Implement property-find by ignoring it.
NestedNameSpecifier * readNestedNameSpecifier()
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.