| 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 2> %t.stderr.txt | FileCheck %s |
| 2 |
// RUN: FileCheck %s --check-prefix=WARN < %t.stderr.txt |
| 3 |
|
| 4 |
// "Split-nest" -- boolean expressions within boolean expressions. |
| 5 |
extern bool bar(bool); |
| 6 |
// CHECK: func_split_nest{{.*}}: |
| 7 |
bool func_split_nest(bool a, bool b, bool c, bool d, bool e, bool f, bool g) { |
| 8 |
// WARN: :[[@LINE+1]]:14: warning: unsupported MC/DC boolean expression; contains an operation with a nested boolean expression. |
| 9 |
bool res = a && b && c && bar(d && e) && f && g; |
| 10 |
return bar(res); |
| 11 |
} |
| 12 |
|
| 13 |
// The inner expr begins with the same Loc as the outer expr |
| 14 |
// CHECK: func_condop{{.*}}: |
| 15 |
bool func_condop(bool a, bool b, bool c) { |
| 16 |
// WARN: :[[@LINE+1]]:10: warning: unsupported MC/DC boolean expression; contains an operation with a nested boolean expression. |
| 17 |
return (a && b ? true : false) && c; |
| 18 |
} |
| 19 |
|
| 20 |
// __builtin_expect |
| 21 |
// Treated as parentheses. |
| 22 |
// CHECK: func_expect{{.*}}: |
| 23 |
bool func_expect(bool a, bool b, bool c) { |
| 24 |
// WARN: :[[@LINE+1]]:10: warning: unsupported MC/DC boolean expression; contains an operation with a nested boolean expression. |
| 25 |
return a || __builtin_expect(b && c, true); |
| 26 |
} |
| 27 |
|
| 28 |
// LNot among BinOp(s) |
| 29 |
// Doesn't split exprs. |
| 30 |
// CHECK: func_lnot{{.*}}: |
| 31 |
bool func_lnot(bool a, bool b, bool c, bool d) { |
| 32 |
return !(a || b) && !(c && d); |
| 33 |
// CHECK: Decision,File 0, [[@LINE-1]]:10 -> [[#L:@LINE-1]]:32 = M:5, C:4 |
| 34 |
// CHECK: Branch,File 0, [[#L]]:12 -> [[#L]]:13 = (#0 - #2), #2 [1,0,3] |
| 35 |
// CHECK: Branch,File 0, [[#L]]:17 -> [[#L]]:18 = (#2 - #3), #3 [3,0,2] |
| 36 |
// CHECK: Branch,File 0, [[#L]]:25 -> [[#L]]:26 = #4, (#1 - #4) [2,4,0] |
| 37 |
// CHECK: Branch,File 0, [[#L]]:30 -> [[#L]]:31 = #5, (#4 - #5) [4,0,0] |
| 38 |
} |