本文整理汇总了C++中GCOVBuffer类的典型用法代码示例。如果您正苦于以下问题:C++ GCOVBuffer类的具体用法?C++ GCOVBuffer怎么用?C++ GCOVBuffer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GCOVBuffer类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: readFunctions
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;
}
示例4: read
/// read - Read GCOV buffer.
bool GCOVFile::read(GCOVBuffer &Buffer) {
GCOV::GCOVFormat Format = Buffer.readGCOVFormat();
if (Format == GCOV::InvalidGCOV)
return false;
unsigned i = 0;
while (1) {
GCOVFunction *GFun = NULL;
if (isGCDAFile(Format)) {
// Use existing function while reading .gcda file.
assert(i < Functions.size() && ".gcda data does not match .gcno data");
GFun = Functions[i];
} else if (isGCNOFile(Format)){
GFun = new GCOVFunction();
Functions.push_back(GFun);
}
if (!GFun || !GFun->read(Buffer, Format))
break;
++i;
}
return true;
}
示例5: 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;
}