brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · bb82873 Raw
35 lines · cpp
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 %s2// RUN: FileCheck %s --check-prefix=WARN < %t.stderr.txt3 4// "Split-nest" -- boolean expressions within boolean expressions.5extern bool bar(bool);6// CHECK: func_split_nest{{.*}}:7bool 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 expr14// CHECK: func_condop{{.*}}:15bool 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_expect21// Treated as parentheses.22// CHECK: func_expect{{.*}}:23bool 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{{.*}}:31bool 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}35