|
| 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 | + // WARN: :[[@LINE+1]]:10: warning: unsupported MC/DC boolean expression; contains an operation with a nested boolean expression. |
| 33 | + return !(a || b) && !(c && d); |
| 34 | +} |
0 commit comments