@@ -123,13 +123,13 @@ fromRust(LLVMRustCounterExprKind Kind) {
123
123
report_fatal_error (" Bad LLVMRustCounterExprKind!" );
124
124
}
125
125
126
- extern " C" void LLVMRustCoverageWriteFilenamesSectionToBuffer (
126
+ extern " C" void LLVMRustCoverageWriteFilenamesToBuffer (
127
127
const char *const Filenames[], size_t FilenamesLen, // String start pointers
128
128
const size_t *const Lengths, size_t LengthsLen, // Corresponding lengths
129
129
RustStringRef BufferOut) {
130
130
if (FilenamesLen != LengthsLen) {
131
131
report_fatal_error (
132
- " Mismatched lengths in LLVMRustCoverageWriteFilenamesSectionToBuffer " );
132
+ " Mismatched lengths in LLVMRustCoverageWriteFilenamesToBuffer " );
133
133
}
134
134
135
135
SmallVector<std::string, 32 > FilenameRefs;
@@ -143,16 +143,15 @@ extern "C" void LLVMRustCoverageWriteFilenamesSectionToBuffer(
143
143
FilenamesWriter.write (OS);
144
144
}
145
145
146
- extern " C" void LLVMRustCoverageWriteMappingToBuffer (
147
- const unsigned *VirtualFileMappingIDs, unsigned NumVirtualFileMappingIDs,
148
- const LLVMRustCounterExpression *RustExpressions, unsigned NumExpressions,
149
- const LLVMRustCoverageCodeRegion *CodeRegions, unsigned NumCodeRegions,
150
- const LLVMRustCoverageBranchRegion *BranchRegions,
151
- unsigned NumBranchRegions,
146
+ extern " C" void LLVMRustCoverageWriteFunctionMappingsToBuffer (
147
+ const unsigned *VirtualFileMappingIDs, size_t NumVirtualFileMappingIDs,
148
+ const LLVMRustCounterExpression *RustExpressions, size_t NumExpressions,
149
+ const LLVMRustCoverageCodeRegion *CodeRegions, size_t NumCodeRegions,
150
+ const LLVMRustCoverageBranchRegion *BranchRegions, size_t NumBranchRegions,
152
151
const LLVMRustCoverageMCDCBranchRegion *MCDCBranchRegions,
153
- unsigned NumMCDCBranchRegions,
152
+ size_t NumMCDCBranchRegions,
154
153
const LLVMRustCoverageMCDCDecisionRegion *MCDCDecisionRegions,
155
- unsigned NumMCDCDecisionRegions, RustStringRef BufferOut) {
154
+ size_t NumMCDCDecisionRegions, RustStringRef BufferOut) {
156
155
// Convert from FFI representation to LLVM representation.
157
156
158
157
// Expressions:
@@ -219,34 +218,37 @@ LLVMRustCoverageCreatePGOFuncNameVar(LLVMValueRef F, const char *FuncName,
219
218
return wrap (createPGOFuncNameVar (*cast<Function>(unwrap (F)), FuncNameRef));
220
219
}
221
220
222
- extern " C" uint64_t LLVMRustCoverageHashByteArray (const char *Bytes,
223
- size_t NumBytes) {
224
- auto StrRef = StringRef (Bytes, NumBytes);
225
- return IndexedInstrProf::ComputeHash (StrRef);
221
+ extern " C" uint64_t LLVMRustCoverageHashBytes (const char *Bytes,
222
+ size_t NumBytes) {
223
+ return IndexedInstrProf::ComputeHash (StringRef (Bytes, NumBytes));
226
224
}
227
225
228
- static void WriteSectionNameToString (LLVMModuleRef M, InstrProfSectKind SK,
229
- RustStringRef Str) {
226
+ // Private helper function for getting the covmap and covfun section names.
227
+ static void writeInstrProfSectionNameToString (LLVMModuleRef M,
228
+ InstrProfSectKind SectKind,
229
+ RustStringRef OutStr) {
230
230
auto TargetTriple = Triple (unwrap (M)->getTargetTriple ());
231
- auto name = getInstrProfSectionName (SK , TargetTriple.getObjectFormat ());
232
- auto OS = RawRustStringOstream (Str );
231
+ auto name = getInstrProfSectionName (SectKind , TargetTriple.getObjectFormat ());
232
+ auto OS = RawRustStringOstream (OutStr );
233
233
OS << name;
234
234
}
235
235
236
- extern " C" void LLVMRustCoverageWriteMapSectionNameToString (LLVMModuleRef M,
237
- RustStringRef Str) {
238
- WriteSectionNameToString (M, IPSK_covmap, Str);
236
+ extern " C" void
237
+ LLVMRustCoverageWriteCovmapSectionNameToString (LLVMModuleRef M,
238
+ RustStringRef OutStr) {
239
+ writeInstrProfSectionNameToString (M, IPSK_covmap, OutStr);
239
240
}
240
241
241
242
extern " C" void
242
- LLVMRustCoverageWriteFuncSectionNameToString (LLVMModuleRef M,
243
- RustStringRef Str ) {
244
- WriteSectionNameToString (M, IPSK_covfun, Str );
243
+ LLVMRustCoverageWriteCovfunSectionNameToString (LLVMModuleRef M,
244
+ RustStringRef OutStr ) {
245
+ writeInstrProfSectionNameToString (M, IPSK_covfun, OutStr );
245
246
}
246
247
247
- extern " C" void LLVMRustCoverageWriteMappingVarNameToString (RustStringRef Str) {
248
+ extern " C" void
249
+ LLVMRustCoverageWriteCovmapVarNameToString (RustStringRef OutStr) {
248
250
auto name = getCoverageMappingVarName ();
249
- auto OS = RawRustStringOstream (Str );
251
+ auto OS = RawRustStringOstream (OutStr );
250
252
OS << name;
251
253
}
252
254
0 commit comments