本文整理汇总了C++中GCOVBuffer::readFunctionTag方法的典型用法代码示例。如果您正苦于以下问题:C++ GCOVBuffer::readFunctionTag方法的具体用法?C++ GCOVBuffer::readFunctionTag怎么用?C++ GCOVBuffer::readFunctionTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GCOVBuffer
的用法示例。
在下文中一共展示了GCOVBuffer::readFunctionTag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readGCDA
/// readGCDA - Read GCDA buffer. It is required that readGCDA() can only be
/// called after readGCNO().
bool GCOVFile::readGCDA(GCOVBuffer &Buffer) {
assert(GCNOInitialized && "readGCDA() can only be called after readGCNO()");
if (!Buffer.readGCDAFormat())
return false;
GCOV::GCOVVersion GCDAVersion;
if (!Buffer.readGCOVVersion(GCDAVersion))
return false;
if (Version != GCDAVersion) {
errs() << "GCOV versions do not match.\n";
return false;
}
uint32_t GCDAChecksum;
if (!Buffer.readInt(GCDAChecksum))
return false;
if (Checksum != GCDAChecksum) {
errs() << "File checksums do not match: " << Checksum
<< " != " << GCDAChecksum << ".\n";
return false;
}
for (size_t i = 0, e = Functions.size(); i < e; ++i) {
if (!Buffer.readFunctionTag()) {
errs() << "Unexpected number of functions.\n";
return false;
}
if (!Functions[i]->readGCDA(Buffer, Version))
return false;
}
if (Buffer.readObjectTag()) {
uint32_t Length;
uint32_t Dummy;
if (!Buffer.readInt(Length))
return false;
if (!Buffer.readInt(Dummy))
return false; // checksum
if (!Buffer.readInt(Dummy))
return false; // num
if (!Buffer.readInt(RunCount))
return false;
Buffer.advanceCursor(Length - 3);
}
while (Buffer.readProgramTag()) {
uint32_t Length;
if (!Buffer.readInt(Length))
return false;
Buffer.advanceCursor(Length);
++ProgramCount;
}
return true;
}
示例2: Options
std::vector<GCOVFunction*>
readFunctions(GCOVFile& GF, GCOVBuffer &GCNOBuffer, GCOVBuffer &GCDABuffer) {
GCOV::GCOVVersion Version;
std::vector<GCOVFunction*> Functions;
uint32_t Checksum;
GCOVOptions Options(true, true, true, true, true, true, false, false);
FileInfo FI(Options);
if (!GCNOBuffer.readGCNOFormat() || !GCDABuffer.readGCDAFormat())
return Functions;
if (!GCNOBuffer.readGCOVVersion(Version) ||
!GCDABuffer.readGCOVVersion(Version))
return Functions;
if (!GCNOBuffer.readInt(Checksum) || !GCDABuffer.readInt(Checksum))
return Functions;
while (true) {
if (!GCNOBuffer.readFunctionTag()) break;
if (!GCDABuffer.readFunctionTag()) break;
auto GFun = new GCOVFunction(GF);
if (!GFun->readGCNO(GCNOBuffer, Version) ||
!GFun->readGCDA(GCDABuffer, Version))
return Functions;
GFun->collectLineCounts(FI);
Functions.push_back(GFun);
}
FI.setRunCount(1);
FI.setProgramCount(1);
return Functions;
}
示例3: readGCNO
/// readGCNO - Read GCNO buffer.
bool GCOVFile::readGCNO(GCOVBuffer &Buffer) {
if (!Buffer.readGCNOFormat()) return false;
if (!Buffer.readGCOVVersion(Version)) return false;
if (!Buffer.readInt(Checksum)) return false;
while (true) {
if (!Buffer.readFunctionTag()) break;
GCOVFunction *GFun = new GCOVFunction(*this);
if (!GFun->readGCNO(Buffer, Version))
return false;
Functions.push_back(GFun);
}
GCNOInitialized = true;
return true;
}
示例4: readGCNO
/// readGCNO - Read GCNO buffer.
bool GCOVFile::readGCNO(GCOVBuffer &Buffer) {
if (!Buffer.readGCNOFormat()) return false;
if (!Buffer.readGCOVVersion(Version)) return false;
if (!Buffer.readInt(Checksum)) return false;
while (true) {
if (!Buffer.readFunctionTag()) break;
auto GFun = make_unique<GCOVFunction>(*this);
if (!GFun->readGCNO(Buffer, Version))
return false;
Functions.push_back(std::move(GFun));
}
GCNOInitialized = true;
return true;
}
示例5: read
/// read - Read a aunction from the buffer. Return false if buffer cursor
/// does not point to a function tag.
bool GCOVFunction::read(GCOVBuffer &Buff, GCOV::GCOVFormat Format) {
if (!Buff.readFunctionTag())
return false;
Buff.readInt(); // Function header length
Ident = Buff.readInt();
Buff.readInt(); // Checksum #1
if (Format != GCOV::GCNO_402)
Buff.readInt(); // Checksum #2
Name = Buff.readString();
if (Format == GCOV::GCNO_402 || Format == GCOV::GCNO_404)
Filename = Buff.readString();
if (Format == GCOV::GCDA_402 || Format == GCOV::GCDA_404) {
Buff.readArcTag();
uint32_t Count = Buff.readInt() / 2;
for (unsigned i = 0, e = Count; i != e; ++i) {
Blocks[i]->addCount(Buff.readInt64());
}
return true;
}
LineNumber = Buff.readInt();
// read blocks.
bool BlockTagFound = Buff.readBlockTag();
(void)BlockTagFound;
assert(BlockTagFound && "Block Tag not found!");
uint32_t BlockCount = Buff.readInt();
for (int i = 0, e = BlockCount; i != e; ++i) {
Buff.readInt(); // Block flags;
Blocks.push_back(new GCOVBlock(i));
}
// read edges.
while (Buff.readEdgeTag()) {
uint32_t EdgeCount = (Buff.readInt() - 1) / 2;
uint32_t BlockNo = Buff.readInt();
assert(BlockNo < BlockCount && "Unexpected Block number!");
for (int i = 0, e = EdgeCount; i != e; ++i) {
Blocks[BlockNo]->addEdge(Buff.readInt());
Buff.readInt(); // Edge flag
}
}
// read line table.
while (Buff.readLineTag()) {
uint32_t LineTableLength = Buff.readInt();
uint32_t Size = Buff.getCursor() + LineTableLength*4;
uint32_t BlockNo = Buff.readInt();
assert(BlockNo < BlockCount && "Unexpected Block number!");
GCOVBlock *Block = Blocks[BlockNo];
Buff.readInt(); // flag
while (Buff.getCursor() != (Size - 4)) {
StringRef Filename = Buff.readString();
if (Buff.getCursor() == (Size - 4)) break;
while (uint32_t L = Buff.readInt())
Block->addLine(Filename, L);
}
Buff.readInt(); // flag
}
return true;
}