Ejemplo n.º 1
0
/// 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;
}
Ejemplo n.º 2
0
/// 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;
}
Ejemplo n.º 3
0
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;
}