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
3 
4 // TEST-COVERAGE: "-ftest-coverage"
5 // TEST-COVERAGE: "-coverage-notes-file" "{{.*}}{{/|\\\\}}coverage.gcno"
6 // NO-TEST-COVERAGE-NOT: "-coverage-notes-file"
7 
8 // RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck --check-prefix=PROFILE-ARCS %s
9 // RUN: %clang -### -S -fprofile-arcs -fno-profile-arcs %s 2>&1 | FileCheck --check-prefix=NO-PROFILE-ARCS %s
10 
11 // PROFILE-ARCS: "-fprofile-arcs"
12 // PROFILE-ARCS: "-coverage-notes-file" "{{.*}}{{/|\\\\}}coverage.c"
13 // NO-PROFILE-ARCS-NOT: "-ftest-coverage"
14 
15 // RUN: %clang -### -S -fprofile-arcs %s -o /foo/bar.o 2>&1 | FileCheck --check-prefix=GCNO-LOCATION %s
16 // RUN: %clang_cl -### /c --coverage /Fo/foo/bar.obj -- %s 2>&1 | FileCheck --check-prefix=GCNO-LOCATION %s
17 // RUN: %clang -### -c -fprofile-arcs %s -o foo/bar.o 2>&1 | FileCheck --check-prefix=GCNO-LOCATION-REL %s
18 
19 // GCNO-LOCATION: "-coverage-notes-file" "{{.*}}/foo/bar.gcno"
20 // GCNO-LOCATION-REL: "-coverage-notes-file" "{{.*}}{{/|\\\\}}foo/bar.gcno"
21 
22 /// Don't warn -Wunused-command-line-argument.
23 // RUN: %clang -E -Werror --coverage -ftest-coverage -fprofile-arcs %s
24 
25 /// Test -fprofile-dir=
26 // RUN: not %clang -S -Werror -fprofile-dir=abc %s
27 // RUN: not %clang -S -Werror -ftest-coverage -fprofile-dir=abc %s
28 // RUN: %clang -### -S -fprofile-arcs -fprofile-dir=abc %s 2>&1 | FileCheck --check-prefix=PROFILE-DIR %s
29 // RUN: %clang -### -S --coverage -fprofile-dir=abc %s 2>&1 | FileCheck --check-prefix=PROFILE-DIR %s
30 
31 // PROFILE-DIR: "-coverage-data-file" "abc
32 
33 /// These should only get passed if any of --coverage, -ftest-coverage, or
34 /// -fprofile-arcs is passed.
35 // RUN: %clang -### -c %s 2>&1 | FileCheck --check-prefix=NO-COV %s
36 // NO-COV-NOT: "-coverage-notes-file"
37 // NO-COV-NOT: "-coverage-data-file"
38