1 // RUN: rm -rf %T/coverage-basic
2 // RUN: mkdir %T/coverage-basic && cd %T/coverage-basic
3 // RUN: %clangxx_asan -fsanitize-coverage=func %s -o test.exe
4 // RUN: %env_asan_opts=coverage=1 %run ./test.exe
5 //
6 // RUN: %sancov print *.sancov | FileCheck %s
7 #include <stdio.h>
8 
foo()9 void foo() { fputs("FOO", stderr); }
bar()10 void bar() { fputs("BAR", stderr); }
11 
main(int argc,char ** argv)12 int main(int argc, char **argv) {
13   if (argc == 2) {
14     foo();
15     bar();
16   } else {
17     bar();
18     foo();
19   }
20 }
21 
22 // CHECK: 0x{{[0-9a-f]*}}
23 // CHECK: 0x{{[0-9a-f]*}}
24 // CHECK: 0x{{[0-9a-f]*}}
25 // CHECK-NOT: 0x{{[0-9a-f]*}}
26