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'};
183 : Stream(Stream), Diags(Diags) {
185 emitBlockInfoBlock();
214 class AbbreviationMap {
215 llvm::DenseMap<unsigned, unsigned> Abbrevs;
220 void add(
RecordId RID,
unsigned AbbrevID);
224 class StreamSubBlockGuard {
225 llvm::BitstreamWriter &Stream;
228 StreamSubBlockGuard(llvm::BitstreamWriter &Stream_,
BlockId ID)
235 StreamSubBlockGuard(
const StreamSubBlockGuard &) =
delete;
236 StreamSubBlockGuard &operator=(
const StreamSubBlockGuard &) =
delete;
238 ~StreamSubBlockGuard() { Stream.ExitBlock(); }
243 void emitVersionBlock();
246 void emitBlockInfoBlock();
247 void emitBlockInfo(
BlockId BID,
const std::vector<RecordId> &RIDs);
250 void emitRecord(StringRef Str,
RecordId ID);
252 void emitRecord(
const Location &Loc,
RecordId ID);
253 void emitRecord(
const Reference &Ref,
RecordId ID);
254 void emitRecord(
bool Value,
RecordId ID);
255 void emitRecord(
int Value,
RecordId ID);
256 void emitRecord(
unsigned Value,
RecordId ID);
257 void emitRecord(
const TemplateInfo &Templ);
258 bool prepRecordData(
RecordId ID,
bool ShouldEmit =
true);
265 SmallVector<uint32_t, BitCodeConstants::RecordSize> Record;
266 llvm::BitstreamWriter &Stream;
267 AbbreviationMap Abbrevs;
268 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