9#ifndef LLVM_CLANG_AST_ABSTRACTBASICWRITER_H
10#define LLVM_CLANG_AST_ABSTRACTBASICWRITER_H
17namespace serialization {
21 return (value.isNull() ? std::optional<T>() : std::optional<T>(value));
25 return (value ? std::optional<T *>(value) : std::optional<T *>());
98#include "clang/AST/AbstractBasicWriter.inc"
122 using BasicWriterBase<Impl>::asImpl;
128 Impl &
find(
const char *propertyName) {
138 asImpl().writeUInt32(uint32_t(value));
142 asImpl().writeUInt32(array.size());
143 for (
const T &elt : array) {
144 WriteDispatcher<T>::write(asImpl(), elt);
149 WriteDispatcher<T>::write(asImpl(), PackOptionalValue<T>::pack(value));
153 asImpl().writeBool(value.isUnsigned());
154 asImpl().writeAPInt(value);
158 asImpl().writeUInt32(value.getBitWidth());
159 const uint64_t *words = value.getRawData();
160 for (
size_t i = 0, e = value.getNumWords(); i != e; ++i)
161 asImpl().writeUInt64(words[i]);
165 asImpl().writeUInt32(sema.getWidth());
166 asImpl().writeUInt32(sema.getScale());
167 asImpl().writeUInt32(sema.isSigned() | sema.isSaturated() << 1 |
168 sema.hasUnsignedPadding() << 2);
175 asImpl().writeQualType(elemTy);
176 asImpl().writeUInt32(path.size());
177 auto &ctx = ((BasicWriterBase<Impl> *)
this)->getASTContext();
178 for (
auto elem : path) {
180 asImpl().writeUInt32(elem.getAsBaseOrMember().getInt());
181 const Decl *baseOrMember = elem.getAsBaseOrMember().getPointer();
182 if (
const auto *
recordDecl = dyn_cast<CXXRecordDecl>(baseOrMember)) {
186 const auto *
valueDecl = cast<ValueDecl>(baseOrMember);
191 asImpl().writeUInt32(elem.getAsArrayIndex());
192 elemTy = ctx.getAsArrayType(elemTy)->getElementType();
199 "update this if the value size changes");
205 asImpl().writeUInt32(uint32_t(esi.
Type));
220 "opaque value doesn't fit into uint32_t");
225 asImpl().writeUInt32(
E.toOpaqueInt32());
239 nestedNames.push_back(NNS);
245 asImpl().writeUInt32(nestedNames.size());
246 while (!nestedNames.empty()) {
247 NNS = nestedNames.pop_back_val();
249 asImpl().writeNestedNameSpecifierKind(kind);
252 asImpl().writeNamespaceBaseDeclRef(
268 llvm_unreachable(
"unexpected null nested name specifier");
270 llvm_unreachable(
"bad nested name specifier kind");
Defines the clang::ASTContext interface.
Defines the C++ template declaration subclasses.
ArrayRef< LValuePathEntry > Path
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...
Expr * getCondition() const
Represents an abstract function effect, using just an enumeration describing its kind.
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>::".
CXXRecordDecl * getAsMicrosoftSuper() const
NamespaceAndPrefix getAsNamespaceAndPrefix() const
const Type * getAsType() const
Kind
The kind of specifier that completes this nested name specifier.
@ 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*.
A (possibly-)qualified type.
The collection of all-type qualifiers we support.
uint64_t getAsOpaqueValue() const
bool isRecordType() const
DataStreamBasicWriter provides convenience implementations for many BasicWriter methods based on the ...
void writeEffectConditionExpr(EffectConditionExpr CE)
void writeExceptionSpecInfo(const FunctionProtoType::ExceptionSpecInfo &esi)
void writeArray(ArrayRef< T > array)
void writeFixedPointSemantics(const llvm::FixedPointSemantics &sema)
void writeNestedNameSpecifier(NestedNameSpecifier NNS)
void writeFunctionEffect(FunctionEffect E)
DataStreamBasicWriter(ASTContext &ctx)
void writeOptional(std::optional< T > value)
void writeExtParameterInfo(FunctionProtoType::ExtParameterInfo epi)
void writeAPInt(const llvm::APInt &value)
Impl & find(const char *propertyName)
Implement property-find by ignoring it.
void writeAPSInt(const llvm::APSInt &value)
void writeLValuePathSerializationHelper(APValue::LValuePathSerializationHelper lvaluePath)
void writeQualifiers(Qualifiers value)
const internal::VariadicDynCastAllOfMatcher< Decl, ValueDecl > valueDecl
Matches any value declaration.
const internal::VariadicDynCastAllOfMatcher< Decl, RecordDecl > recordDecl
Matches class, struct, and union declarations.
std::optional< T > makeOptionalFromNullable(const T &value)
std::optional< T * > makeOptionalFromPointer(T *value)
The JSON file list parser is used to communicate input to InstallAPI.
bool isComputedNoexcept(ExceptionSpecificationType ESpecType)
const FunctionProtoType * T
@ 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.
const NamespaceBaseDecl * Namespace
NestedNameSpecifier Prefix