forked from OSchip/llvm-project
PR21195: Emit .gcno files to the proper location.
When building with coverage, -no-integrated-as, and -c, the driver was emitting -cc1 -coverage-file pointing at a file in /tmp. Ensure the coverage file is emitted in the same directory as the output file. llvm-svn: 219460
This commit is contained in:
parent
2754dbb4ab
commit
b8e7eaedcb
|
@ -3241,7 +3241,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
C.getArgs().hasArg(options::OPT_S)) {
|
||||
if (Output.isFilename()) {
|
||||
CmdArgs.push_back("-coverage-file");
|
||||
SmallString<128> CoverageFilename(Output.getFilename());
|
||||
SmallString<128> CoverageFilename;
|
||||
Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o);
|
||||
if (FinalOutput) {
|
||||
CoverageFilename = FinalOutput->getValue();
|
||||
} else {
|
||||
CoverageFilename = llvm::sys::path::filename(Output.getBaseInput());
|
||||
}
|
||||
if (llvm::sys::path::is_relative(CoverageFilename.str())) {
|
||||
SmallString<128> Pwd;
|
||||
if (!llvm::sys::fs::current_path(Pwd)) {
|
||||
|
|
|
@ -66,6 +66,23 @@
|
|||
// CHECK-PROFILE-ARCS: "-femit-coverage-data"
|
||||
// CHECK-NO-PROFILE-ARCS-NOT: "-femit-coverage-data"
|
||||
|
||||
// RUN: %clang -### -S -fprofile-arcs %s 2>&1 | FileCheck -check-prefix=CHECK-GCNO-DEFAULT-LOCATION %s
|
||||
// RUN: %clang -### -S -fprofile-arcs -no-integrated-as %s 2>&1 | FileCheck -check-prefix=CHECK-GCNO-DEFAULT-LOCATION %s
|
||||
// RUN: %clang -### -c -fprofile-arcs %s 2>&1 | FileCheck -check-prefix=CHECK-GCNO-DEFAULT-LOCATION %s
|
||||
// RUN: %clang -### -c -fprofile-arcs -no-integrated-as %s 2>&1 | FileCheck -check-prefix=CHECK-GCNO-DEFAULT-LOCATION %s
|
||||
// RUN: %clang -### -S -fprofile-arcs %s -o /foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION %s
|
||||
// RUN: %clang -### -S -fprofile-arcs -no-integrated-as %s -o /foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION %s
|
||||
// RUN: %clang -### -c -fprofile-arcs %s -o /foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION %s
|
||||
// RUN: %clang -### -c -fprofile-arcs -no-integrated-as %s -o /foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION %s
|
||||
// RUN: %clang -### -S -fprofile-arcs %s -o foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION-REL-PATH %s
|
||||
// RUN: %clang -### -S -fprofile-arcs -no-integrated-as %s -o foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION-REL-PATH %s
|
||||
// RUN: %clang -### -c -fprofile-arcs %s -o foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION-REL-PATH %s
|
||||
// RUN: %clang -### -c -fprofile-arcs -no-integrated-as %s -o foo/bar.o 2>&1 | FileCheck -check-prefix=CHECK-GCNO-LOCATION-REL-PATH %s
|
||||
// CHECK-GCNO-DEFAULT-LOCATION: "-coverage-file" "{{.*}}/clang_f_opts.c"
|
||||
// CHECK-GCNO-DEFAULT-LOCATION-NOT: "-coverage-file" "/tmp/{{.*}}/clang_f_opts.c"
|
||||
// CHECK-GCNO-LOCATION: "-coverage-file" "/foo/bar.o"
|
||||
// CHECK-GCNO-LOCATION-REL-PATH: "-coverage-file" "{{.*}}/foo/bar.o"
|
||||
|
||||
// RUN: %clang -### -S -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
|
||||
// RUN: %clang -### -S -fno-vectorize -fvectorize %s 2>&1 | FileCheck -check-prefix=CHECK-VECTORIZE %s
|
||||
// RUN: %clang -### -S -fno-vectorize %s 2>&1 | FileCheck -check-prefix=CHECK-NO-VECTORIZE %s
|
||||
|
|
Loading…
Reference in New Issue