You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Aligns to C++ struct llvm::coverage::Counter::CounterKind.
114
-
/// The order of discrimiators is important.
113
+
/// Aligns with [llvm::coverage::CounterMappingRegion::RegionKind](https://github.com/rust-lang/llvm-project/blob/rustc/10.0-2020-05-05/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L205-L221)
115
114
#[derive(Copy,Clone,Debug)]
116
115
#[repr(C)]
117
116
enumRegionKind{
118
117
/// A CodeRegion associates some code with a counter
119
-
CodeRegion,
118
+
CodeRegion = 0,
120
119
121
120
/// An ExpansionRegion represents a file expansion region that associates
122
121
/// a source range with the expansion of a virtual source file, such as
123
122
/// for a macro instantiation or #include file.
124
-
ExpansionRegion,
123
+
ExpansionRegion = 1,
125
124
126
125
/// A SkippedRegion represents a source range with code that was skipped
127
126
/// by a preprocessor or similar means.
128
-
SkippedRegion,
127
+
SkippedRegion = 2,
129
128
130
129
/// A GapRegion is like a CodeRegion, but its count is only set as the
131
130
/// line execution count when its the only region in the line.
132
-
GapRegion,
131
+
GapRegion = 3,
133
132
}
134
133
135
134
/// This struct provides LLVM's representation of a "CoverageMappingRegion", encoded into the
136
-
/// coverage map in accordance with LLVM's "Coverage Mapping Format". The struct composes fields
137
-
/// representing the `Counter` type and value(s) (injected counter ID, or expression type and
138
-
/// operands), the source file (an indirect index into a "filenames array", encoded separately),
139
-
/// and source location (start and end positions of the represented code region).
/// The struct composes fields representing the `Counter` type and value(s) (injected counter ID,
138
+
/// or expression type and operands), the source file (an indirect index into a "filenames array",
139
+
/// encoded separately), and source location (start and end positions of the represented code
140
+
/// region).
140
141
///
141
-
/// Aligns to C++ struct llvm::coverage::CounterMappingRegion.
142
-
/// The order of fields is important.
142
+
/// Aligns with [llvm::coverage::CounterMappingRegion](https://github.com/rust-lang/llvm-project/blob/rustc/10.0-2020-05-05/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L223-L226)
143
+
/// Important: The Rust struct layout (order and types of fields) must match its C++ counterpart.
Copy file name to clipboardexpand all lines: src/librustc_codegen_ssa/coverageinfo/map.rs
+16-16
Original file line number
Diff line number
Diff line change
@@ -7,26 +7,28 @@ use std::cmp::{Ord, Ordering};
7
7
use std::fmt;
8
8
use std::path::PathBuf;
9
9
10
-
/// Aligns to C++ struct llvm::coverage::Counter::CounterKind.
11
-
/// The order of discriminators is important.
10
+
/// Aligns with [llvm::coverage::Counter::CounterKind](https://github.com/rust-lang/llvm-project/blob/rustc/10.0-2020-05-05/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L91)
12
11
#[derive(Copy,Clone,Debug)]
13
12
#[repr(C)]
14
13
enumCounterKind{
15
-
Zero,
16
-
CounterValueReference,
17
-
Expression,
14
+
Zero = 0,
15
+
CounterValueReference = 1,
16
+
Expression = 2,
18
17
}
19
18
20
-
/// Aligns to C++ struct llvm::coverage::Counter. Note that `id` has
21
-
/// different interpretations, depending on the `kind`:
19
+
/// A reference to an instance of an abstract "counter" that will yield a value in a coverage
20
+
/// report. Note that `id` has different interpretations, depending on the `kind`:
22
21
/// * For `CounterKind::Zero`, `id` is assumed to be `0`
23
22
/// * For `CounterKind::CounterValueReference`, `id` matches the `counter_id` of the injected
24
23
/// instrumentation counter (the `index` argument to the LLVM intrinsic `instrprof.increment()`)
25
-
/// * For `CounterKind::Expression`, `id` is the index into the array of counter expressions.
26
-
/// The order of fields is important.
24
+
/// * For `CounterKind::Expression`, `id` is the index into the coverage map's array of counter
25
+
/// expressions.
26
+
/// Aligns with [llvm::coverage::Counter](https://github.com/rust-lang/llvm-project/blob/rustc/10.0-2020-05-05/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L98-L99)
27
+
/// Important: The Rust struct layout (order and types of fields) must match its C++ counterpart.
27
28
#[derive(Copy,Clone,Debug)]
28
29
#[repr(C)]
29
30
pubstructCounter{
31
+
// Important: The layout (order and types of fields) must match its C++ counterpart.
30
32
kind:CounterKind,
31
33
id:u32,
32
34
}
@@ -45,21 +47,19 @@ impl Counter {
45
47
}
46
48
}
47
49
48
-
/// Aligns to C++ struct llvm::coverage::CounterExpression::ExprKind.
49
-
/// The order of discriminators is important.
50
+
/// Aligns with [llvm::coverage::CounterExpression::ExprKind](https://github.com/rust-lang/llvm-project/blob/rustc/10.0-2020-05-05/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L146)
50
51
#[derive(Copy,Clone,Debug)]
51
52
#[repr(C)]
52
53
pubenumExprKind{
53
-
Subtract,
54
-
Add,
54
+
Subtract = 0,
55
+
Add = 1,
55
56
}
56
57
57
-
/// Aligns to C++ struct llvm::coverage::CounterExpression.
58
-
/// The order of fields is important.
58
+
/// Aligns with [llvm::coverage::CounterExpression](https://github.com/rust-lang/llvm-project/blob/rustc/10.0-2020-05-05/llvm/include/llvm/ProfileData/Coverage/CoverageMapping.h#L147-L148)
59
+
/// Important: The Rust struct layout (order and types of fields) must match its C++ counterpart.
0 commit comments