1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00
llvm-mirror/test/tools/llvm-cov/showHighlightedRanges.cpp
Vedant Kumar 5d6e7b38df [llvm-cov] Delete custom JSON serialization code (NFC)
Teach llvm-cov to use the new llvm JSON library, and remove some
redundant/brittle JSON serialization tests.

llvm-svn: 342088
2018-09-12 21:59:38 +00:00

48 lines
1.8 KiB
C++

// RUN: llvm-cov show %S/Inputs/highlightedRanges.covmapping -instr-profile %S/Inputs/highlightedRanges.profdata -dump -path-equivalence=/tmp,%S %s 2>&1 | FileCheck %s -check-prefixes=TEXT,SHARED
void func() {
return;
int i = 0; // SHARED: Highlighted line [[@LINE]], 3 ->
} // SHARED: Highlighted line [[@LINE]], 1 -> 2
void func2(int x) {
if(x > 5) {
while(x >= 9) {
return;
--x; // SHARED: Highlighted line [[@LINE]], 7 ->
}
int i = 0; // SHARED: Highlighted line [[@LINE]], 5 ->
} // SHARED: Highlighted line [[@LINE]], 1 -> 4
}
void test() {
int x = 0;
if (x) { // SHARED: Highlighted line [[@LINE]], 10 ->
x = 0; // SHARED: Highlighted line [[@LINE]], 1 ->
} else { // SHARED: Highlighted line [[@LINE]], 1 -> 4
x = 1;
}
// SHARED: Highlighted line [[@LINE+1]], 26 ->
for (int i = 0; i < 0; ++i) { // SHARED: Highlighted line [[@LINE]], 31 ->
x = 1; // SHARED: Highlighted line [[@LINE]], 1 ->
} // SHARED: Highlighted line [[@LINE]], 1 -> 4
x = x < 10 ? x +
1
: x - 1; // SHARED: Highlighted line [[@LINE]], 16 -> 21
x = x > 10 ? x + // SHARED: Highlighted line [[@LINE]], 16 ->
1 // SHARED: Highlighted line [[@LINE]], 1 -> 17
: x - 1;
}
int main() {
test();
func();
func2(9);
return 0;
}
// RUN: llvm-cov show %S/Inputs/highlightedRanges.covmapping -instr-profile %S/Inputs/highlightedRanges.profdata -format html -dump -path-equivalence=/tmp,%S %s 2>&1 | FileCheck %s -check-prefixes=HTML,SHARED