|
9 | 9 | #ifndef CLANG_AST_ABSTRACTBASICWRITER_H
|
10 | 10 | #define CLANG_AST_ABSTRACTBASICWRITER_H
|
11 | 11 |
|
| 12 | +#include "clang/AST/ASTContext.h" |
12 | 13 | #include "clang/AST/DeclTemplate.h"
|
13 | 14 |
|
14 | 15 | namespace clang {
|
@@ -121,6 +122,7 @@ template <class Impl>
|
121 | 122 | class DataStreamBasicWriter : public BasicWriterBase<Impl> {
|
122 | 123 | protected:
|
123 | 124 | using BasicWriterBase<Impl>::asImpl;
|
| 125 | + DataStreamBasicWriter(ASTContext &ctx) : BasicWriterBase<Impl>(ctx) {} |
124 | 126 |
|
125 | 127 | public:
|
126 | 128 | /// Implement property-find by ignoring it. We rely on properties being
|
@@ -163,6 +165,39 @@ class DataStreamBasicWriter : public BasicWriterBase<Impl> {
|
163 | 165 | asImpl().writeUInt64(words[i]);
|
164 | 166 | }
|
165 | 167 |
|
| 168 | + void writeFixedPointSemantics(const llvm::FixedPointSemantics &sema) { |
| 169 | + asImpl().writeUInt32(sema.getWidth()); |
| 170 | + asImpl().writeUInt32(sema.getScale()); |
| 171 | + asImpl().writeUInt32(sema.isSigned() | sema.isSaturated() << 1 | |
| 172 | + sema.hasUnsignedPadding() << 2); |
| 173 | + } |
| 174 | + |
| 175 | + void writeLValuePathSerializationHelper( |
| 176 | + APValue::LValuePathSerializationHelper lvaluePath) { |
| 177 | + ArrayRef<APValue::LValuePathEntry> path = lvaluePath.Path; |
| 178 | + QualType elemTy = lvaluePath.getType(); |
| 179 | + asImpl().writeQualType(elemTy); |
| 180 | + asImpl().writeUInt32(path.size()); |
| 181 | + auto &ctx = ((BasicWriterBase<Impl> *)this)->getASTContext(); |
| 182 | + for (auto elem : path) { |
| 183 | + if (elemTy->getAs<RecordType>()) { |
| 184 | + asImpl().writeUInt32(elem.getAsBaseOrMember().getInt()); |
| 185 | + const Decl *baseOrMember = elem.getAsBaseOrMember().getPointer(); |
| 186 | + if (const auto *recordDecl = dyn_cast<CXXRecordDecl>(baseOrMember)) { |
| 187 | + asImpl().writeDeclRef(recordDecl); |
| 188 | + elemTy = ctx.getRecordType(recordDecl); |
| 189 | + } else { |
| 190 | + const auto *valueDecl = cast<ValueDecl>(baseOrMember); |
| 191 | + asImpl().writeDeclRef(valueDecl); |
| 192 | + elemTy = valueDecl->getType(); |
| 193 | + } |
| 194 | + } else { |
| 195 | + asImpl().writeUInt32(elem.getAsArrayIndex()); |
| 196 | + elemTy = ctx.getAsArrayType(elemTy)->getElementType(); |
| 197 | + } |
| 198 | + } |
| 199 | + } |
| 200 | + |
166 | 201 | void writeQualifiers(Qualifiers value) {
|
167 | 202 | static_assert(sizeof(value.getAsOpaqueValue()) <= sizeof(uint32_t),
|
168 | 203 | "update this if the value size changes");
|
|
0 commit comments