xref: /llvm-project/clang/test/CoverageMapping/mcdc-class.cpp (revision 71f8b441ed6a944ceb4530b49e8588dcbb1e0066)
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 extern void foo();
4 extern void bar();
5 class Value {
6   public:
7     void setValue( int len );
8     int getValue( void );
9     Value();   // This is the constructor declaration
10     ~Value();  // This is the destructor declaration
11 
12   private:
13     int value;
14 };
15 
16 // Member functions definitions including constructor
Value(void)17 Value::Value(void) {
18   if (value == 2 || value == 6)
19     foo();
20 }
~Value(void)21 Value::~Value(void) {
22   if (value == 2 || value == 3)
23     bar();
24 }
25 
26 // CHECK-LABEL:  Decision,File 0, 18:7 -> 18:31 = M:3, C:2
27 // CHECK-NEXT:  Branch,File 0, 18:7 -> 18:17 = (#0 - #2), #2 [1,0,2]
28 // CHECK:  Branch,File 0, 18:21 -> 18:31 = (#2 - #3), #3 [2,0,0]
29 // CHECK-LABEL:  Decision,File 0, 22:7 -> 22:31 = M:3, C:2
30 // CHECK-NEXT:  Branch,File 0, 22:7 -> 22:17 = (#0 - #2), #2 [1,0,2]
31 // CHECK:  Branch,File 0, 22:21 -> 22:31 = (#2 - #3), #3 [2,0,0]
32