mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-10-02 02:55:35 +00:00
Update GCOVLines to provide interfaces to write line table and calculate complete length.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140167 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
f34fa6f34e
commit
16c19a155c
@ -158,7 +158,8 @@ namespace {
|
|||||||
class GCOVBlock;
|
class GCOVBlock;
|
||||||
|
|
||||||
// Constructed only by requesting it from a GCOVBlock, this object stores a
|
// Constructed only by requesting it from a GCOVBlock, this object stores a
|
||||||
// list of line numbers representing lines that belong to the block.
|
// list of line numbers and a single filename, representing lines that belong
|
||||||
|
// to the block.
|
||||||
class GCOVLines : public GCOVRecord {
|
class GCOVLines : public GCOVRecord {
|
||||||
public:
|
public:
|
||||||
void addLine(uint32_t Line) {
|
void addLine(uint32_t Line) {
|
||||||
@ -166,17 +167,25 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint32_t length() {
|
uint32_t length() {
|
||||||
// FIXME: ??? What is the significance of 2 here ?
|
// Here 2 = 1 for string lenght + 1 for '0' id#.
|
||||||
return 2 + Lines.size();
|
return lengthOfGCOVString(Filename) + 2 + Lines.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void writeOut() {
|
||||||
|
write(0);
|
||||||
|
writeGCOVString(Filename);
|
||||||
|
for (int i = 0, e = Lines.size(); i != e; ++i)
|
||||||
|
write(Lines[i]);
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
friend class GCOVBlock;
|
friend class GCOVBlock;
|
||||||
|
|
||||||
GCOVLines(raw_ostream *os) {
|
GCOVLines(StringRef F, raw_ostream *os)
|
||||||
|
: Filename(F) {
|
||||||
this->os = os;
|
this->os = os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
StringRef Filename;
|
||||||
SmallVector<uint32_t, 32> Lines;
|
SmallVector<uint32_t, 32> Lines;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -188,7 +197,7 @@ namespace {
|
|||||||
GCOVLines &getFile(StringRef Filename) {
|
GCOVLines &getFile(StringRef Filename) {
|
||||||
GCOVLines *&Lines = LinesByFile[Filename];
|
GCOVLines *&Lines = LinesByFile[Filename];
|
||||||
if (!Lines) {
|
if (!Lines) {
|
||||||
Lines = new GCOVLines(os);
|
Lines = new GCOVLines(Filename, os);
|
||||||
}
|
}
|
||||||
return *Lines;
|
return *Lines;
|
||||||
}
|
}
|
||||||
@ -201,20 +210,15 @@ namespace {
|
|||||||
uint32_t Len = 3;
|
uint32_t Len = 3;
|
||||||
for (StringMap<GCOVLines *>::iterator I = LinesByFile.begin(),
|
for (StringMap<GCOVLines *>::iterator I = LinesByFile.begin(),
|
||||||
E = LinesByFile.end(); I != E; ++I) {
|
E = LinesByFile.end(); I != E; ++I) {
|
||||||
Len = Len + lengthOfGCOVString(I->first()) + I->second->length();
|
Len += I->second->length();
|
||||||
}
|
}
|
||||||
|
|
||||||
writeBytes(LinesTag, 4);
|
writeBytes(LinesTag, 4);
|
||||||
write(Len);
|
write(Len);
|
||||||
write(Number);
|
write(Number);
|
||||||
for (StringMap<GCOVLines *>::iterator I = LinesByFile.begin(),
|
for (StringMap<GCOVLines *>::iterator I = LinesByFile.begin(),
|
||||||
E = LinesByFile.end(); I != E; ++I) {
|
E = LinesByFile.end(); I != E; ++I)
|
||||||
write(0);
|
I->second->writeOut();
|
||||||
writeGCOVString(I->first());
|
|
||||||
for (int i = 0, e = I->second->Lines.size(); i != e; ++i) {
|
|
||||||
write(I->second->Lines[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
write(0);
|
write(0);
|
||||||
write(0);
|
write(0);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user