Clang Project

clang_source_code/test/CoverageMapping/lambda.cpp
1// RUN: %clang_cc1 -x c++ -std=c++11 -triple %itanium_abi_triple -fprofile-instrument=clang -fcoverage-mapping -dump-coverage-mapping -emit-llvm-only %s -main-file-name lambda.cpp | FileCheck %s
2
3// CHECK-LABEL: _Z3fooi:
4void foo(int i) { // CHECK: File 0, [[@LINE]]:17 -> {{[0-9]+}}:2 = #0
5  auto f = [](int x) {
6    return x + 1;
7  };
8
9  f(i);
10  // Make sure the zero region after the return doesn't escape the lambda.
11  // CHECK-NOT: File 0, {{[0-9:]+}} -> [[@LINE+1]]:2 = 0
12}
13
14int main(int argc, const char *argv[]) {
15  foo(1);
16  return 0;
17}
18