xref: /llvm-project/clang/test/CoverageMapping/lambda.cpp (revision 9caa3fbe03f43e3eec30262fbba87c1ee15c05a3)
1*9caa3fbeSZequan Wu // RUN: %clang_cc1 -mllvm -emptyline-comment-coverage=false -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
2c109102eSJustin Bogner 
3c109102eSJustin Bogner // CHECK-LABEL: _Z3fooi:
foo(int i)4c109102eSJustin Bogner void foo(int i) { // CHECK: File 0, [[@LINE]]:17 -> {{[0-9]+}}:2 = #0
5c109102eSJustin Bogner   auto f = [](int x) {
6c109102eSJustin Bogner     return x + 1;
7c109102eSJustin Bogner   };
8c109102eSJustin Bogner 
9c109102eSJustin Bogner   f(i);
10c109102eSJustin Bogner   // Make sure the zero region after the return doesn't escape the lambda.
11c109102eSJustin Bogner   // CHECK-NOT: File 0, {{[0-9:]+}} -> [[@LINE+1]]:2 = 0
12c109102eSJustin Bogner }
13c109102eSJustin Bogner 
main(int argc,const char * argv[])14c109102eSJustin Bogner int main(int argc, const char *argv[]) {
15c109102eSJustin Bogner   foo(1);
16c109102eSJustin Bogner   return 0;
17c109102eSJustin Bogner }
18