llvm.org GIT mirror llvm / 0066f92
Simplify. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@140789 91177308-0d34-0410-b5e6-96231b3b80d8 Devang Patel 8 years ago
1 changed file(s) with 18 addition(s) and 12 deletion(s). Raw diff Collapse all Expand all
2626 DeleteContainerPointers(Functions);
2727 }
2828
29 /// isGCDAFile - Return true if Format identifies a .gcda file.
30 static bool isGCDAFile(GCOVFormat Format) {
31 return Format == GCDA_402 || Format == GCDA_404;
32 }
33
34 /// isGCNOFile - Return true if Format identifies a .gcno file.
35 static bool isGCNOFile(GCOVFormat Format) {
36 return Format == GCNO_402 || Format == GCNO_404;
37 }
38
2939 /// read - Read GCOV buffer.
3040 bool GCOVFile::read(GCOVBuffer &Buffer) {
3141 GCOVFormat Format = Buffer.readGCOVFormat();
3545 unsigned i = 0;
3646 while (1) {
3747 GCOVFunction *GFun = NULL;
38 if (Format == GCDA_402 || Format == GCDA_404) {
39 if (i < Functions.size())
40 GFun = Functions[i];
41 } else
48 if (isGCDAFile(Format)) {
49 // Use existing function while reading .gcda file.
50 assert (i < Functions.size() && ".gcda data does not match .gcno data");
51 GFun = Functions[i];
52 } else if (isGCNOFile(Format)){
4253 GFun = new GCOVFunction();
43
44 if (GFun && GFun->read(Buffer, Format)) {
45 if (Format == GCNO_402 || Format == GCNO_404)
46 Functions.push_back(GFun);
47 }
48 else {
49 delete GFun;
54 Functions.push_back(GFun);
55 }
56 if (!GFun || !GFun->read(Buffer, Format))
5057 break;
51 }
5258 ++i;
5359 }
5460 return true;