diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2021-02-20 16:43:05 +0100 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2021-03-01 23:35:35 +0100 |
| commit | 1d280b012d52fa95ed59942701e1a32c662e58a3 (patch) | |
| tree | e13affc7fd15c93c94c98bab34082a868a40157d /compiler/rustc_codegen_llvm/src/llvm/ffi.rs | |
| parent | b763d9a40c526f5f72c0668d26f69241e7a42511 (diff) | |
| download | rust-1d280b012d52fa95ed59942701e1a32c662e58a3.tar.gz rust-1d280b012d52fa95ed59942701e1a32c662e58a3.zip | |
Don't directly expose coverage::CounterMappingRegion via FFI
The definition of this struct changes in LLVM 12 due to the addition of branch coverage support. To avoid future mismatches, declare our own struct and then convert between them.
Diffstat (limited to 'compiler/rustc_codegen_llvm/src/llvm/ffi.rs')
| -rw-r--r-- | compiler/rustc_codegen_llvm/src/llvm/ffi.rs | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs index 9eac7ad17b0..7f7575e58c9 100644 --- a/compiler/rustc_codegen_llvm/src/llvm/ffi.rs +++ b/compiler/rustc_codegen_llvm/src/llvm/ffi.rs @@ -676,9 +676,7 @@ pub mod coverageinfo { /// array", encoded separately), and source location (start and end positions of the represented /// code region). /// - /// Aligns with [llvm::coverage::CounterMappingRegion](https://github.com/rust-lang/llvm-project/blob/rustc/11.0-2020-10-12/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L224-L227) - /// Important: The Rust struct layout (order and types of fields) must match its C++ - /// counterpart. + /// Matches LLVMRustCounterMappingRegion. #[derive(Copy, Clone, Debug)] #[repr(C)] pub struct CounterMappingRegion { @@ -1796,7 +1794,7 @@ extern "C" { NumVirtualFileMappingIDs: c_uint, Expressions: *const coverage_map::CounterExpression, NumExpressions: c_uint, - MappingRegions: *mut coverageinfo::CounterMappingRegion, + MappingRegions: *const coverageinfo::CounterMappingRegion, NumMappingRegions: c_uint, BufferOut: &RustString, ); |
