| 1 |
// RUN: %clang_cc1 -triple %itanium_abi_triple -std=c++11 -fcoverage-mcdc -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s | FileCheck %s |
| 2 |
|
| 3 |
bool func_if_and(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 4 |
if (a && b && c && d && e && f) |
| 5 |
return true; |
| 6 |
return false; |
| 7 |
} |
| 8 |
|
| 9 |
// CHECK-LABEL: Decision,File 0, 4:7 -> 4:33 = M:7, C:6 |
| 10 |
// CHECK-NEXT: Branch,File 0, 4:7 -> 4:8 = #10, (#0 - #10) [1,6,0] |
| 11 |
// CHECK: Branch,File 0, 4:12 -> 4:13 = #11, (#10 - #11) [6,5,0] |
| 12 |
// CHECK: Branch,File 0, 4:17 -> 4:18 = #9, (#8 - #9) [5,4,0] |
| 13 |
// CHECK: Branch,File 0, 4:22 -> 4:23 = #7, (#6 - #7) [4,3,0] |
| 14 |
// CHECK: Branch,File 0, 4:27 -> 4:28 = #5, (#4 - #5) [3,2,0] |
| 15 |
// CHECK: Branch,File 0, 4:32 -> 4:33 = #3, (#2 - #3) [2,0,0] |
| 16 |
|
| 17 |
bool func_if_or(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 18 |
if (a || b || c || d || e || f) |
| 19 |
return true; |
| 20 |
return false; |
| 21 |
} |
| 22 |
|
| 23 |
// CHECK-LABEL: Decision,File 0, 18:7 -> 18:33 = M:7, C:6 |
| 24 |
// CHECK-NEXT: Branch,File 0, 18:7 -> 18:8 = (#0 - #10), #10 [1,0,6] |
| 25 |
// CHECK: Branch,File 0, 18:12 -> 18:13 = (#10 - #11), #11 [6,0,5] |
| 26 |
// CHECK: Branch,File 0, 18:17 -> 18:18 = (#8 - #9), #9 [5,0,4] |
| 27 |
// CHECK: Branch,File 0, 18:22 -> 18:23 = (#6 - #7), #7 [4,0,3] |
| 28 |
// CHECK: Branch,File 0, 18:27 -> 18:28 = (#4 - #5), #5 [3,0,2] |
| 29 |
// CHECK: Branch,File 0, 18:32 -> 18:33 = (#2 - #3), #3 [2,0,0] |
| 30 |
|
| 31 |
bool func_while_and(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 32 |
while (a && b && c && d && e && f) { return true; } |
| 33 |
return false; |
| 34 |
} |
| 35 |
|
| 36 |
// CHECK-LABEL: Decision,File 0, 32:10 -> 32:36 = M:7, C:6 |
| 37 |
// CHECK-NEXT: Branch,File 0, 32:10 -> 32:11 = #10, (#0 - #10) [1,6,0] |
| 38 |
// CHECK: Branch,File 0, 32:15 -> 32:16 = #11, (#10 - #11) [6,5,0] |
| 39 |
// CHECK: Branch,File 0, 32:20 -> 32:21 = #9, (#8 - #9) [5,4,0] |
| 40 |
// CHECK: Branch,File 0, 32:25 -> 32:26 = #7, (#6 - #7) [4,3,0] |
| 41 |
// CHECK: Branch,File 0, 32:30 -> 32:31 = #5, (#4 - #5) [3,2,0] |
| 42 |
// CHECK: Branch,File 0, 32:35 -> 32:36 = #3, (#2 - #3) [2,0,0] |
| 43 |
|
| 44 |
bool func_while_or(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 45 |
while (a || b || c || d || e || f) { return true; } |
| 46 |
return false; |
| 47 |
} |
| 48 |
|
| 49 |
// CHECK-LABEL: Decision,File 0, 45:10 -> 45:36 = M:7, C:6 |
| 50 |
// CHECK-NEXT: Branch,File 0, 45:10 -> 45:11 = (#0 - #10), #10 [1,0,6] |
| 51 |
// CHECK: Branch,File 0, 45:15 -> 45:16 = (#10 - #11), #11 [6,0,5] |
| 52 |
// CHECK: Branch,File 0, 45:20 -> 45:21 = (#8 - #9), #9 [5,0,4] |
| 53 |
// CHECK: Branch,File 0, 45:25 -> 45:26 = (#6 - #7), #7 [4,0,3] |
| 54 |
// CHECK: Branch,File 0, 45:30 -> 45:31 = (#4 - #5), #5 [3,0,2] |
| 55 |
// CHECK: Branch,File 0, 45:35 -> 45:36 = (#2 - #3), #3 [2,0,0] |
| 56 |
|
| 57 |
bool func_for_and(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 58 |
for (;a && b && c && d && e && f;) { return true; } |
| 59 |
return false; |
| 60 |
} |
| 61 |
|
| 62 |
// CHECK-LABEL: Decision,File 0, 58:9 -> 58:35 = M:7, C:6 |
| 63 |
// CHECK-NEXT: Branch,File 0, 58:9 -> 58:10 = #10, (#0 - #10) [1,6,0] |
| 64 |
// CHECK: Branch,File 0, 58:14 -> 58:15 = #11, (#10 - #11) [6,5,0] |
| 65 |
// CHECK: Branch,File 0, 58:19 -> 58:20 = #9, (#8 - #9) [5,4,0] |
| 66 |
// CHECK: Branch,File 0, 58:24 -> 58:25 = #7, (#6 - #7) [4,3,0] |
| 67 |
// CHECK: Branch,File 0, 58:29 -> 58:30 = #5, (#4 - #5) [3,2,0] |
| 68 |
// CHECK: Branch,File 0, 58:34 -> 58:35 = #3, (#2 - #3) [2,0,0] |
| 69 |
|
| 70 |
bool func_for_or(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 71 |
for (;a || b || c || d || e || f;) { return true; } |
| 72 |
return false; |
| 73 |
} |
| 74 |
|
| 75 |
// CHECK-LABEL: Decision,File 0, 71:9 -> 71:35 = M:7, C:6 |
| 76 |
// CHECK-NEXT: Branch,File 0, 71:9 -> 71:10 = (#0 - #10), #10 [1,0,6] |
| 77 |
// CHECK: Branch,File 0, 71:14 -> 71:15 = (#10 - #11), #11 [6,0,5] |
| 78 |
// CHECK: Branch,File 0, 71:19 -> 71:20 = (#8 - #9), #9 [5,0,4] |
| 79 |
// CHECK: Branch,File 0, 71:24 -> 71:25 = (#6 - #7), #7 [4,0,3] |
| 80 |
// CHECK: Branch,File 0, 71:29 -> 71:30 = (#4 - #5), #5 [3,0,2] |
| 81 |
// CHECK: Branch,File 0, 71:34 -> 71:35 = (#2 - #3), #3 [2,0,0] |
| 82 |
|
| 83 |
bool func_do_and(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 84 |
do {} while (a && b && c && d && e && f); |
| 85 |
return false; |
| 86 |
} |
| 87 |
|
| 88 |
// CHECK-LABEL: Decision,File 0, 84:16 -> 84:42 = M:7, C:6 |
| 89 |
// CHECK-NEXT: Branch,File 0, 84:16 -> 84:17 = #10, ((#0 + #1) - #10) [1,6,0] |
| 90 |
// CHECK: Branch,File 0, 84:21 -> 84:22 = #11, (#10 - #11) [6,5,0] |
| 91 |
// CHECK: Branch,File 0, 84:26 -> 84:27 = #9, (#8 - #9) [5,4,0] |
| 92 |
// CHECK: Branch,File 0, 84:31 -> 84:32 = #7, (#6 - #7) [4,3,0] |
| 93 |
// CHECK: Branch,File 0, 84:36 -> 84:37 = #5, (#4 - #5) [3,2,0] |
| 94 |
// CHECK: Branch,File 0, 84:41 -> 84:42 = #3, (#2 - #3) [2,0,0] |
| 95 |
|
| 96 |
bool func_do_or(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 97 |
do {} while (a || b || c || d || e || f); |
| 98 |
return false; |
| 99 |
} |
| 100 |
|
| 101 |
// CHECK-LABEL: Decision,File 0, 97:16 -> 97:42 = M:7, C:6 |
| 102 |
// CHECK-NEXT: Branch,File 0, 97:16 -> 97:17 = ((#0 + #1) - #10), #10 [1,0,6] |
| 103 |
// CHECK: Branch,File 0, 97:21 -> 97:22 = (#10 - #11), #11 [6,0,5] |
| 104 |
// CHECK: Branch,File 0, 97:26 -> 97:27 = (#8 - #9), #9 [5,0,4] |
| 105 |
// CHECK: Branch,File 0, 97:31 -> 97:32 = (#6 - #7), #7 [4,0,3] |
| 106 |
// CHECK: Branch,File 0, 97:36 -> 97:37 = (#4 - #5), #5 [3,0,2] |
| 107 |
// CHECK: Branch,File 0, 97:41 -> 97:42 = (#2 - #3), #3 [2,0,0] |
| 108 |
|
| 109 |
bool func_ternary_and(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 110 |
return (a && b && c && d && e && f) ? true : false; |
| 111 |
} |
| 112 |
|
| 113 |
// CHECK-LABEL: Decision,File 0, 110:11 -> 110:37 = M:7, C:6 |
| 114 |
// CHECK-NEXT: Branch,File 0, 110:11 -> 110:12 = #10, (#0 - #10) [1,6,0] |
| 115 |
// CHECK: Branch,File 0, 110:16 -> 110:17 = #11, (#10 - #11) [6,5,0] |
| 116 |
// CHECK: Branch,File 0, 110:21 -> 110:22 = #9, (#8 - #9) [5,4,0] |
| 117 |
// CHECK: Branch,File 0, 110:26 -> 110:27 = #7, (#6 - #7) [4,3,0] |
| 118 |
// CHECK: Branch,File 0, 110:31 -> 110:32 = #5, (#4 - #5) [3,2,0] |
| 119 |
// CHECK: Branch,File 0, 110:36 -> 110:37 = #3, (#2 - #3) [2,0,0] |
| 120 |
|
| 121 |
bool func_ternary_or(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 122 |
return (a || b || c || d || e || f) ? true : false; |
| 123 |
} |
| 124 |
|
| 125 |
// CHECK-LABEL: Decision,File 0, 122:11 -> 122:37 = M:7, C:6 |
| 126 |
// CHECK-NEXT: Branch,File 0, 122:11 -> 122:12 = (#0 - #10), #10 [1,0,6] |
| 127 |
// CHECK: Branch,File 0, 122:16 -> 122:17 = (#10 - #11), #11 [6,0,5] |
| 128 |
// CHECK: Branch,File 0, 122:21 -> 122:22 = (#8 - #9), #9 [5,0,4] |
| 129 |
// CHECK: Branch,File 0, 122:26 -> 122:27 = (#6 - #7), #7 [4,0,3] |
| 130 |
// CHECK: Branch,File 0, 122:31 -> 122:32 = (#4 - #5), #5 [3,0,2] |
| 131 |
// CHECK: Branch,File 0, 122:36 -> 122:37 = (#2 - #3), #3 [2,0,0] |
| 132 |
|
| 133 |
bool func_if_nested_if(bool a, bool b, bool c, bool d, bool e) { |
| 134 |
if (a || (b && c) || d || e) |
| 135 |
return true; |
| 136 |
else |
| 137 |
return false; |
| 138 |
} |
| 139 |
|
| 140 |
// CHECK-LABEL: Decision,File 0, 134:7 -> 134:30 = M:8, C:5 |
| 141 |
// CHECK-NEXT: Branch,File 0, 134:7 -> 134:8 = (#0 - #6), #6 [1,0,4] |
| 142 |
// CHECK: Branch,File 0, 134:13 -> 134:14 = #7, (#6 - #7) [4,5,3] |
| 143 |
// CHECK: Branch,File 0, 134:18 -> 134:19 = #8, (#7 - #8) [5,0,3] |
| 144 |
// CHECK: Branch,File 0, 134:24 -> 134:25 = (#4 - #5), #5 [3,0,2] |
| 145 |
// CHECK: Branch,File 0, 134:29 -> 134:30 = (#2 - #3), #3 [2,0,0] |
| 146 |
|
| 147 |
bool func_ternary_nested_if(bool a, bool b, bool c, bool d, bool e) { |
| 148 |
return (a || (b && c) || d || e) ? true : false; |
| 149 |
} |
| 150 |
|
| 151 |
// CHECK-LABEL: Decision,File 0, 148:11 -> 148:34 = M:8, C:5 |
| 152 |
// CHECK-NEXT: Branch,File 0, 148:11 -> 148:12 = (#0 - #6), #6 [1,0,4] |
| 153 |
// CHECK: Branch,File 0, 148:17 -> 148:18 = #7, (#6 - #7) [4,5,3] |
| 154 |
// CHECK: Branch,File 0, 148:22 -> 148:23 = #8, (#7 - #8) [5,0,3] |
| 155 |
// CHECK: Branch,File 0, 148:28 -> 148:29 = (#4 - #5), #5 [3,0,2] |
| 156 |
// CHECK: Branch,File 0, 148:33 -> 148:34 = (#2 - #3), #3 [2,0,0] |
| 157 |
|
| 158 |
bool func_if_nested_if_2(bool a, bool b, bool c, bool d, bool e) { |
| 159 |
if (a || ((b && c) || d) && e) |
| 160 |
return true; |
| 161 |
else |
| 162 |
return false; |
| 163 |
} |
| 164 |
|
| 165 |
// CHECK-LABEL: Decision,File 0, 159:7 -> 159:32 = M:9, C:5 |
| 166 |
// CHECK-NEXT: Branch,File 0, 159:7 -> 159:8 = (#0 - #2), #2 [1,0,2] |
| 167 |
// CHECK: Branch,File 0, 159:14 -> 159:15 = #7, (#2 - #7) [2,5,4] |
| 168 |
// CHECK: Branch,File 0, 159:19 -> 159:20 = #8, (#7 - #8) [5,3,4] |
| 169 |
// CHECK: Branch,File 0, 159:25 -> 159:26 = (#5 - #6), #6 [4,3,0] |
| 170 |
// CHECK: Branch,File 0, 159:31 -> 159:32 = #4, (#3 - #4) [3,0,0] |
| 171 |
|
| 172 |
bool func_ternary_nested_if_2(bool a, bool b, bool c, bool d, bool e) { |
| 173 |
return (a || ((b && c) || d) && e) ? true : false; |
| 174 |
} |
| 175 |
|
| 176 |
// CHECK-LABEL: Decision,File 0, 173:11 -> 173:36 = M:9, C:5 |
| 177 |
// CHECK-NEXT: Branch,File 0, 173:11 -> 173:12 = (#0 - #2), #2 [1,0,2] |
| 178 |
// CHECK: Branch,File 0, 173:18 -> 173:19 = #7, (#2 - #7) [2,5,4] |
| 179 |
// CHECK: Branch,File 0, 173:23 -> 173:24 = #8, (#7 - #8) [5,3,4] |
| 180 |
// CHECK: Branch,File 0, 173:29 -> 173:30 = (#5 - #6), #6 [4,3,0] |
| 181 |
// CHECK: Branch,File 0, 173:35 -> 173:36 = #4, (#3 - #4) [3,0,0] |
| 182 |
|
| 183 |
bool func_if_nested_if_3(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 184 |
if ((a && (b || c) || (d && e)) && f) |
| 185 |
return true; |
| 186 |
else |
| 187 |
return false; |
| 188 |
} |
| 189 |
|
| 190 |
// CHECK-LABEL: Decision,File 0, 184:7 -> 184:39 = M:12, C:6 |
| 191 |
// CHECK: Branch,File 0, 184:8 -> 184:9 = #5, (#0 - #5) [1,4,3] |
| 192 |
// CHECK: Branch,File 0, 184:14 -> 184:15 = (#5 - #6), #6 [4,2,5] |
| 193 |
// CHECK: Branch,File 0, 184:19 -> 184:20 = (#6 - #7), #7 [5,2,3] |
| 194 |
// CHECK: Branch,File 0, 184:26 -> 184:27 = #8, (#4 - #8) [3,6,0] |
| 195 |
// CHECK: Branch,File 0, 184:31 -> 184:32 = #9, (#8 - #9) [6,2,0] |
| 196 |
// CHECK: Branch,File 0, 184:38 -> 184:39 = #3, (#2 - #3) [2,0,0] |
| 197 |
|
| 198 |
bool func_ternary_nested_if_3(bool a, bool b, bool c, bool d, bool e, bool f) { |
| 199 |
return ((a && (b || c) || (d && e)) && f) ? true : false; |
| 200 |
} |
| 201 |
|
| 202 |
// CHECK-LABEL: Decision,File 0, 199:11 -> 199:43 = M:12, C:6 |
| 203 |
// CHECK: Branch,File 0, 199:12 -> 199:13 = #5, (#0 - #5) [1,4,3] |
| 204 |
// CHECK: Branch,File 0, 199:18 -> 199:19 = (#5 - #6), #6 [4,2,5] |
| 205 |
// CHECK: Branch,File 0, 199:23 -> 199:24 = (#6 - #7), #7 [5,2,3] |
| 206 |
// CHECK: Branch,File 0, 199:30 -> 199:31 = #8, (#4 - #8) [3,6,0] |
| 207 |
// CHECK: Branch,File 0, 199:35 -> 199:36 = #9, (#8 - #9) [6,2,0] |
| 208 |
// CHECK: Branch,File 0, 199:42 -> 199:43 = #3, (#2 - #3) [2,0,0] |