Clang Project

clang_source_code/test/CoverageMapping/nestedclass.cpp
1// RUN: %clang_cc1 -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only -main-file-name nestedclass.cpp %s > %tmapping
2// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-OUTER
3// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-INNER
4// RUN: FileCheck -input-file %tmapping %s --check-prefix=CHECK-INNERMOST
5
6struct Test {                   // CHECK-OUTER: emitTest
7  void emitTest() {             // CHECK-OUTER: File 0, [[@LINE]]:19 -> [[@LINE+2]]:4 = #0
8    int i = 0;
9  }
10  struct Test2 {                // CHECK-INNER: emitTest2
11    void emitTest2() {          // CHECK-INNER: File 0, [[@LINE]]:22 -> [[@LINE+2]]:6 = #0
12      int i = 0;
13    }
14    struct Test3 {              // CHECK-INNERMOST: emitTest3
15      static void emitTest3() { // CHECK-INNERMOST: File 0, [[@LINE]]:31 -> [[@LINE+2]]:8 = 0
16        int i = 0;
17      }
18    };
19  };
20};
21
22int main() {
23  Test t;
24  Test::Test2 t2;
25  t.emitTest();
26  t2.emitTest2();
27  return 0;
28}
29