15#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_BITCODEWRITER_H
16#define LLVM_CLANG_TOOLS_EXTRA_CLANG_DOC_BITCODEWRITER_H
19#include "clang/Basic/Diagnostic.h"
20#include "llvm/ADT/DenseMap.h"
21#include "llvm/Bitstream/BitstreamWriter.h"
44 static constexpr unsigned char Signature[4] = {
'D',
'O',
'C',
'S'};
180 : Stream(Stream), Diags(Diags) {
182 emitBlockInfoBlock();
211 class AbbreviationMap {
212 llvm::DenseMap<unsigned, unsigned> Abbrevs;
217 void add(
RecordId RID,
unsigned AbbrevID);
221 class StreamSubBlockGuard {
222 llvm::BitstreamWriter &Stream;
225 StreamSubBlockGuard(llvm::BitstreamWriter &Stream_,
BlockId ID)
232 StreamSubBlockGuard(
const StreamSubBlockGuard &) =
delete;
233 StreamSubBlockGuard &operator=(
const StreamSubBlockGuard &) =
delete;
235 ~StreamSubBlockGuard() { Stream.ExitBlock(); }
240 void emitVersionBlock();
243 void emitBlockInfoBlock();
244 void emitBlockInfo(
BlockId BID,
const std::vector<RecordId> &RIDs);
247 void emitRecord(StringRef Str,
RecordId ID);
249 void emitRecord(
const Location &Loc,
RecordId ID);
250 void emitRecord(
const Reference &Ref,
RecordId ID);
251 void emitRecord(
bool Value,
RecordId ID);
252 void emitRecord(
int Value,
RecordId ID);
253 void emitRecord(
unsigned Value,
RecordId ID);
254 void emitRecord(
const TemplateInfo &Templ);
255 bool prepRecordData(
RecordId ID,
bool ShouldEmit =
true);
262 SmallVector<uint32_t, BitCodeConstants::RecordSize> Record;
263 llvm::BitstreamWriter &Stream;
264 AbbreviationMap Abbrevs;
265 DiagnosticsEngine &Diags;
void emitBlock(const NamespaceInfo &I)
ClangDocBitcodeWriter(llvm::BitstreamWriter &Stream, DiagnosticsEngine &Diags)
bool dispatchInfoForWrite(Info *I)
@ TEMPLATE_SPECIALIZATION_OF
@ MEMBER_TYPE_IS_TEMPLATE
@ TEMPLATE_PARAM_CONTENTS
@ CONCEPT_CONSTRAINT_EXPRESSION
static constexpr unsigned BlockIdCount
static const unsigned VersionNumber
static constexpr unsigned RecordIdCount
std::array< uint8_t, 20 > SymbolID
@ BI_TEMPLATE_SPECIALIZATION_BLOCK_ID
@ BI_TEMPLATE_PARAM_BLOCK_ID
@ BI_MEMBER_TYPE_BLOCK_ID
@ BI_BASE_RECORD_BLOCK_ID
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
static constexpr unsigned BoolSize
static constexpr unsigned LineNumberSize
static constexpr unsigned FilenameLengthSize
static constexpr unsigned RecordSize
static constexpr int USRHashSize
static constexpr unsigned StringLengthSize
static constexpr unsigned USRBitLengthSize
static constexpr unsigned char Signature[4]
static constexpr unsigned IntSize
static constexpr unsigned SignatureBitSize
static constexpr unsigned SubblockIDSize
static constexpr unsigned USRLengthSize
static constexpr unsigned ReferenceTypeSize