LLVM: lib/Support/CodeGenCoverage.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
13
21
22using namespace llvm;
23
25
30}
31
34 return false;
36}
37
41}
42
45
47
48 const char *LexedBackendName = CurPtr;
49 while (*CurPtr++ != 0)
50 ;
52 return false;
53
54 bool IsForThisBackend = BackendName == LexedBackendName;
56 if (std::distance(CurPtr, Buffer.getBufferEnd()) < 8)
57 return false;
58
61 CurPtr += 8;
62
63
64 if (RuleID == ~0ull)
65 break;
66
67
68
69 if (IsForThisBackend)
71 }
72 }
73
74 return true;
75}
76
82
83
84
85
87
88 std::string CoverageFilename = (CoveragePrefix + Pid).str();
89
90 std::error_code EC;
92 std::unique_ptr CoverageFile =
93 std::make_unique(CoverageFilename, EC, OpenFlags);
94 if (EC)
95 return false;
96
99 CoverageFile->os() << BackendName;
100 CoverageFile->os().write((const char *)&Zero, sizeof(unsigned char));
102 CoverageFile->os().write((const char *)&I, sizeof(uint64_t));
103 CoverageFile->os().write((const char *)&InvZero, sizeof(uint64_t));
104
105 CoverageFile->keep();
106 }
107
108 return true;
109}
110
static const std::string CoveragePrefix
Provides a library for accessing information about this process and other processes on the operating ...
void resize(unsigned N, bool t=false)
resize - Grow or shrink the bitvector.
iterator_range< const_set_bits_iterator > set_bits() const
size_type size() const
size - Returns the number of bits in this bitvector.
bool empty() const
empty - Tests whether there are no bits in this bitvector.
bool isCovered(uint64_t RuleID) const
void setCovered(uint64_t RuleID)
iterator_range< const_covered_iterator > covered() const
bool parse(MemoryBuffer &Buffer, StringRef BackendName)
bool emit(StringRef FilePrefix, StringRef BackendName) const
This interface provides simple read-only access to a block of memory, and provides simple methods for...
const char * getBufferEnd() const
const char * getBufferStart() const
StringRef - Represent a constant reference to a string, i.e.
A range adaptor for a pair of iterators.
static Pid getProcessId()
Get the process's identifier.
SmartMutex - A mutex with a compile time constant parameter that indicates whether this mutex should ...
uint64_t read64(const void *P, endianness E)
@ OF_Append
The file should be opened in append mode.
std::lock_guard< SmartMutex< mt_only > > SmartScopedLock
This is an optimization pass for GlobalISel generic memory operations.
std::string to_string(const T &Value)