xref: /llvm-project/clang/test/CoverageMapping/mcdc-class.cpp (revision 71f8b441ed6a944ceb4530b49e8588dcbb1e0066)
18b2bdfbcSAlan Phipps // 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
28b2bdfbcSAlan Phipps 
38b2bdfbcSAlan Phipps extern void foo();
48b2bdfbcSAlan Phipps extern void bar();
58b2bdfbcSAlan Phipps class Value {
68b2bdfbcSAlan Phipps   public:
78b2bdfbcSAlan Phipps     void setValue( int len );
88b2bdfbcSAlan Phipps     int getValue( void );
98b2bdfbcSAlan Phipps     Value();   // This is the constructor declaration
108b2bdfbcSAlan Phipps     ~Value();  // This is the destructor declaration
118b2bdfbcSAlan Phipps 
128b2bdfbcSAlan Phipps   private:
138b2bdfbcSAlan Phipps     int value;
148b2bdfbcSAlan Phipps };
158b2bdfbcSAlan Phipps 
168b2bdfbcSAlan Phipps // Member functions definitions including constructor
Value(void)178b2bdfbcSAlan Phipps Value::Value(void) {
188b2bdfbcSAlan Phipps   if (value == 2 || value == 6)
198b2bdfbcSAlan Phipps     foo();
208b2bdfbcSAlan Phipps }
~Value(void)218b2bdfbcSAlan Phipps Value::~Value(void) {
228b2bdfbcSAlan Phipps   if (value == 2 || value == 3)
238b2bdfbcSAlan Phipps     bar();
248b2bdfbcSAlan Phipps }
258b2bdfbcSAlan Phipps 
26*71f8b441SNAKAMURA Takumi // CHECK-LABEL:  Decision,File 0, 18:7 -> 18:31 = M:3, C:2
278b2bdfbcSAlan Phipps // CHECK-NEXT:  Branch,File 0, 18:7 -> 18:17 = (#0 - #2), #2 [1,0,2]
288b2bdfbcSAlan Phipps // CHECK:  Branch,File 0, 18:21 -> 18:31 = (#2 - #3), #3 [2,0,0]
29*71f8b441SNAKAMURA Takumi // CHECK-LABEL:  Decision,File 0, 22:7 -> 22:31 = M:3, C:2
308b2bdfbcSAlan Phipps // CHECK-NEXT:  Branch,File 0, 22:7 -> 22:17 = (#0 - #2), #2 [1,0,2]
318b2bdfbcSAlan Phipps // CHECK:  Branch,File 0, 22:21 -> 22:31 = (#2 - #3), #3 [2,0,0]
32