Move the GCOVFormat enums into their own namespace per the LLVM coding standard.
llvm-svn: 163008
This commit is contained in:
parent
0e167f7368
commit
6bbe48967a
|
|
@ -27,13 +27,15 @@ class GCOVBlock;
|
||||||
class GCOVLines;
|
class GCOVLines;
|
||||||
class FileInfo;
|
class FileInfo;
|
||||||
|
|
||||||
enum GCOVFormat {
|
namespace GCOV {
|
||||||
|
enum GCOVFormat {
|
||||||
InvalidGCOV,
|
InvalidGCOV,
|
||||||
GCNO_402,
|
GCNO_402,
|
||||||
GCNO_404,
|
GCNO_404,
|
||||||
GCDA_402,
|
GCDA_402,
|
||||||
GCDA_404
|
GCDA_404
|
||||||
};
|
};
|
||||||
|
} // end GCOV namespace
|
||||||
|
|
||||||
/// GCOVBuffer - A wrapper around MemoryBuffer to provide GCOV specific
|
/// GCOVBuffer - A wrapper around MemoryBuffer to provide GCOV specific
|
||||||
/// read operations.
|
/// read operations.
|
||||||
|
|
@ -42,20 +44,20 @@ public:
|
||||||
GCOVBuffer(MemoryBuffer *B) : Buffer(B), Cursor(0) {}
|
GCOVBuffer(MemoryBuffer *B) : Buffer(B), Cursor(0) {}
|
||||||
|
|
||||||
/// readGCOVFormat - Read GCOV signature at the beginning of buffer.
|
/// readGCOVFormat - Read GCOV signature at the beginning of buffer.
|
||||||
enum GCOVFormat readGCOVFormat() {
|
GCOV::GCOVFormat readGCOVFormat() {
|
||||||
StringRef Magic = Buffer->getBuffer().slice(0, 12);
|
StringRef Magic = Buffer->getBuffer().slice(0, 12);
|
||||||
Cursor = 12;
|
Cursor = 12;
|
||||||
if (Magic == "oncg*404MVLL")
|
if (Magic == "oncg*404MVLL")
|
||||||
return GCNO_404;
|
return GCOV::GCNO_404;
|
||||||
else if (Magic == "oncg*204MVLL")
|
else if (Magic == "oncg*204MVLL")
|
||||||
return GCNO_402;
|
return GCOV::GCNO_402;
|
||||||
else if (Magic == "adcg*404MVLL")
|
else if (Magic == "adcg*404MVLL")
|
||||||
return GCDA_404;
|
return GCOV::GCDA_404;
|
||||||
else if (Magic == "adcg*204MVLL")
|
else if (Magic == "adcg*204MVLL")
|
||||||
return GCDA_402;
|
return GCOV::GCDA_402;
|
||||||
|
|
||||||
Cursor = 0;
|
Cursor = 0;
|
||||||
return InvalidGCOV;
|
return GCOV::InvalidGCOV;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// readFunctionTag - If cursor points to a function tag then increment the
|
/// readFunctionTag - If cursor points to a function tag then increment the
|
||||||
|
|
@ -170,7 +172,7 @@ class GCOVFunction {
|
||||||
public:
|
public:
|
||||||
GCOVFunction() : Ident(0), LineNumber(0) {}
|
GCOVFunction() : Ident(0), LineNumber(0) {}
|
||||||
~GCOVFunction();
|
~GCOVFunction();
|
||||||
bool read(GCOVBuffer &Buffer, GCOVFormat Format);
|
bool read(GCOVBuffer &Buffer, GCOV::GCOVFormat Format);
|
||||||
void dump();
|
void dump();
|
||||||
void collectLineCounts(FileInfo &FI);
|
void collectLineCounts(FileInfo &FI);
|
||||||
private:
|
private:
|
||||||
|
|
|
||||||
|
|
@ -28,19 +28,19 @@ GCOVFile::~GCOVFile() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isGCDAFile - Return true if Format identifies a .gcda file.
|
/// isGCDAFile - Return true if Format identifies a .gcda file.
|
||||||
static bool isGCDAFile(GCOVFormat Format) {
|
static bool isGCDAFile(GCOV::GCOVFormat Format) {
|
||||||
return Format == GCDA_402 || Format == GCDA_404;
|
return Format == GCOV::GCDA_402 || Format == GCOV::GCDA_404;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// isGCNOFile - Return true if Format identifies a .gcno file.
|
/// isGCNOFile - Return true if Format identifies a .gcno file.
|
||||||
static bool isGCNOFile(GCOVFormat Format) {
|
static bool isGCNOFile(GCOV::GCOVFormat Format) {
|
||||||
return Format == GCNO_402 || Format == GCNO_404;
|
return Format == GCOV::GCNO_402 || Format == GCOV::GCNO_404;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// read - Read GCOV buffer.
|
/// read - Read GCOV buffer.
|
||||||
bool GCOVFile::read(GCOVBuffer &Buffer) {
|
bool GCOVFile::read(GCOVBuffer &Buffer) {
|
||||||
GCOVFormat Format = Buffer.readGCOVFormat();
|
GCOV::GCOVFormat Format = Buffer.readGCOVFormat();
|
||||||
if (Format == InvalidGCOV)
|
if (Format == GCOV::InvalidGCOV)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
unsigned i = 0;
|
unsigned i = 0;
|
||||||
|
|
@ -87,21 +87,21 @@ GCOVFunction::~GCOVFunction() {
|
||||||
|
|
||||||
/// read - Read a aunction from the buffer. Return false if buffer cursor
|
/// read - Read a aunction from the buffer. Return false if buffer cursor
|
||||||
/// does not point to a function tag.
|
/// does not point to a function tag.
|
||||||
bool GCOVFunction::read(GCOVBuffer &Buff, GCOVFormat Format) {
|
bool GCOVFunction::read(GCOVBuffer &Buff, GCOV::GCOVFormat Format) {
|
||||||
if (!Buff.readFunctionTag())
|
if (!Buff.readFunctionTag())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
Buff.readInt(); // Function header length
|
Buff.readInt(); // Function header length
|
||||||
Ident = Buff.readInt();
|
Ident = Buff.readInt();
|
||||||
Buff.readInt(); // Checksum #1
|
Buff.readInt(); // Checksum #1
|
||||||
if (Format != GCNO_402)
|
if (Format != GCOV::GCNO_402)
|
||||||
Buff.readInt(); // Checksum #2
|
Buff.readInt(); // Checksum #2
|
||||||
|
|
||||||
Name = Buff.readString();
|
Name = Buff.readString();
|
||||||
if (Format == GCNO_402 || Format == GCNO_404)
|
if (Format == GCOV::GCNO_402 || Format == GCOV::GCNO_404)
|
||||||
Filename = Buff.readString();
|
Filename = Buff.readString();
|
||||||
|
|
||||||
if (Format == GCDA_402 || Format == GCDA_404) {
|
if (Format == GCOV::GCDA_402 || Format == GCOV::GCDA_404) {
|
||||||
Buff.readArcTag();
|
Buff.readArcTag();
|
||||||
uint32_t Count = Buff.readInt() / 2;
|
uint32_t Count = Buff.readInt() / 2;
|
||||||
for (unsigned i = 0, e = Count; i != e; ++i) {
|
for (unsigned i = 0, e = Count; i != e; ++i) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue