[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Driver / coverage.c
blobe5ed064aab457c80d44653a38c23bc6b1b62d8e8
1 // RUN: %clang -### -S -ftest-coverage %s 2>&1 | FileCheck --check-prefix=TEST-COVERAGE %s
2 // RUN: %clang -### -S -ftest-coverage -fno-test-coverage %s 2>&1 | FileCheck --check-prefix=NO-TEST-COVERAGE %s
4 // TEST-COVERAGE: "-coverage-notes-file={{.*}}{{/|\\\\}}coverage.gcno"
5 // NO-TEST-COVERAGE-NOT: "-coverage-notes-file=
7 // RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck --check-prefix=PROFILE-ARCS %s
8 // RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs %s 2>&1 | FileCheck --check-prefix=NO-PROFILE-ARCS %s
10 // NO-PROFILE-ARCS-NOT: "-coverage-notes-file=
11 // PROFILE-ARCS: "-coverage-data-file={{.*}}{{/|\\\\}}coverage.gcda"
13 // RUN: %clang -### -S -ftest-coverage %s -o /foo/bar.o 2>&1 | FileCheck --check-prefix=GCNO-LOCATION %s
14 // RUN: %clang_cl -### /c --coverage /Fo/foo/bar.obj -- %s 2>&1 | FileCheck --check-prefix=GCNO-LOCATION %s
15 // RUN: %clang -### -c -ftest-coverage %s -o foo/bar.o 2>&1 | FileCheck --check-prefix=GCNO-LOCATION-REL %s
17 // GCNO-LOCATION: "-coverage-notes-file={{.*}}/foo/bar.gcno"
18 // GCNO-LOCATION-REL: "-coverage-notes-file={{.*}}{{/|\\\\}}foo/bar.gcno"
20 /// GCC allows PWD to change the paths.
21 // RUN: %if system-linux %{ PWD=/proc/self/cwd %clang -### -c --coverage %s -o foo/bar.o 2>&1 | FileCheck --check-prefix=PWD %s %}
22 // PWD: "-coverage-notes-file=/proc/self/cwd/foo/bar.gcno" "-coverage-data-file=/proc/self/cwd/foo/bar.gcda"
24 /// Don't warn -Wunused-command-line-argument.
25 // RUN: %clang -E -Werror --coverage -ftest-coverage -fprofile-arcs %s
27 /// Test -fprofile-dir=
28 // RUN: not %clang -S -Werror -fprofile-dir=abc %s
29 // RUN: not %clang -S -Werror -ftest-coverage -fprofile-dir=abc %s
30 // RUN: %clang -### -S -fprofile-arcs -fprofile-dir=abc %s 2>&1 | FileCheck --check-prefix=PROFILE-DIR %s
31 // RUN: %clang -### -S --coverage -fprofile-dir=abc %s 2>&1 | FileCheck --check-prefix=PROFILE-DIR %s
33 // PROFILE-DIR: "-coverage-data-file=abc
35 /// These should only get passed if any of --coverage, -ftest-coverage, or
36 /// -fprofile-arcs is passed.
37 // RUN: %clang -### -c %s 2>&1 | FileCheck --check-prefix=NO-COV %s
38 // NO-COV-NOT: "-coverage-notes-file=
39 // NO-COV-NOT: "-coverage-data-file=
41 // RUN: rm -rf %t && mkdir %t && cd %t
42 // RUN: mkdir d e f && cp %s d/a.c && touch d/b.c
44 // RUN: %clang -### --coverage d/a.c d/b.c -o e/x 2>&1 | FileCheck %s --check-prefix=LINK1
45 // LINK1: -cc1{{.*}} "-coverage-notes-file={{.*}}{{/|\\\\}}e/x-a.gcno" "-coverage-data-file={{.*}}{{/|\\\\}}e/x-a.gcda"
46 // LINK1: -cc1{{.*}} "-coverage-notes-file={{.*}}{{/|\\\\}}e/x-b.gcno" "-coverage-data-file={{.*}}{{/|\\\\}}e/x-b.gcda"
48 // RUN: %clang -### --coverage d/a.c d/b.c -o e/x -dumpdir f/g 2>&1 | FileCheck %s --check-prefix=LINK2
49 // LINK2: -cc1{{.*}} "-coverage-notes-file={{.*}}{{/|\\\\}}f/ga.gcno" "-coverage-data-file={{.*}}{{/|\\\\}}f/ga.gcda"
50 // LINK2: -cc1{{.*}} "-coverage-notes-file={{.*}}{{/|\\\\}}f/gb.gcno" "-coverage-data-file={{.*}}{{/|\\\\}}f/gb.gcda"
52 /// GCC allows PWD to change the paths.
53 // RUN: %if system-linux %{ PWD=/proc/self/cwd %clang -### --coverage d/a.c d/b.c -o e/x -fprofile-dir=f 2>&1 | FileCheck %s --check-prefix=LINK3 %}
54 // LINK3: -cc1{{.*}} "-coverage-notes-file=/proc/self/cwd/e/x-a.gcno" "-coverage-data-file=f/proc/self/cwd/e/x-a.gcda"
55 // LINK3: -cc1{{.*}} "-coverage-notes-file=/proc/self/cwd/e/x-b.gcno" "-coverage-data-file=f/proc/self/cwd/e/x-b.gcda"