[PATCH] D54195: Fix linker option for -fprofile-arcs -ftest-coverage
Jessica Han via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 8 12:18:01 PST 2018
jessicah updated this revision to Diff 173209.
jessicah added a comment.
Updated diff with additional context upon review comments.
Repository:
rC Clang
https://reviews.llvm.org/D54195
Files:
lib/Driver/ToolChains/Linux.cpp
test/Driver/clang_f_opts.c
Index: test/Driver/clang_f_opts.c
===================================================================
--- test/Driver/clang_f_opts.c
+++ test/Driver/clang_f_opts.c
@@ -85,6 +85,9 @@
// CHECK-PROFILE-DIR-UNUSED-NOT: "-coverage-data-file" "abc
// CHECK-PROFILE-DIR-NEITHER-NOT: argument unused
+// RUN: %clang -### -fprofile-arcs -ftest-coverage %s 2>&1 | FileCheck -check-prefix=CHECK-u %s
+// CHECK-u-NOT: "-u{{.*}}"
+
// RUN: %clang -### -S -fprofile-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-LLVM %s
// RUN: %clang -### -S -fprofile-instr-generate %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE %s
// RUN: %clang -### -S -fprofile-generate=/some/dir %s 2>&1 | FileCheck -check-prefix=CHECK-PROFILE-GENERATE-DIR %s
Index: lib/Driver/ToolChains/Linux.cpp
===================================================================
--- lib/Driver/ToolChains/Linux.cpp
+++ lib/Driver/ToolChains/Linux.cpp
@@ -1016,7 +1016,7 @@
// Add linker option -u__llvm_runtime_variable to cause runtime
// initialization module to be linked in.
- if (!Args.hasArg(options::OPT_coverage))
+ if ((!Args.hasArg(options::OPT_coverage)) && (!Args.hasArg(options::OPT_ftest_coverage)))
CmdArgs.push_back(Args.MakeArgString(
Twine("-u", llvm::getInstrProfRuntimeHookVarName())));
ToolChain::addProfileRTLibs(Args, CmdArgs);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D54195.173209.patch
Type: text/x-patch
Size: 1363 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20181108/47888fec/attachment.bin>
More information about the cfe-commits
mailing list