summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/ToolChains.cpp
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2015-10-22 06:15:31 +0000
committerXinliang David Li <davidxl@google.com>2015-10-22 06:15:31 +0000
commit69306c08234ba591f4e2cb71ea33b671464d0035 (patch)
treea8ceb8dc174f4d5db7bba1e39cf45a41de0fc2d8 /clang/lib/Driver/ToolChains.cpp
parentcfd53b4e999301c5d6c7785c34c49d4e952e8aa4 (diff)
downloadbcm5719-llvm-69306c08234ba591f4e2cb71ea33b671464d0035.tar.gz
bcm5719-llvm-69306c08234ba591f4e2cb71ea33b671464d0035.zip
clang driver toolchain refactoring
In this patch, the file static method addProfileRT is moved to be a virtual member function of base ToolChain class. This allows derived toolchain to override the default behavior easily and make it consistent with Darwin toolchain (a TODO was added for this refactoring - now removed). A new helper method is also introduced to test if instrumentation profile option is turned on or not. Differential Revision: http://reviews.llvm.org/D13326 llvm-svn: 250994
Diffstat (limited to 'clang/lib/Driver/ToolChains.cpp')
-rw-r--r--clang/lib/Driver/ToolChains.cpp11
1 files changed, 2 insertions, 9 deletions
diff --git a/clang/lib/Driver/ToolChains.cpp b/clang/lib/Driver/ToolChains.cpp
index 6438ea7606a..e8a2d833d3c 100644
--- a/clang/lib/Driver/ToolChains.cpp
+++ b/clang/lib/Driver/ToolChains.cpp
@@ -300,15 +300,7 @@ void MachO::AddLinkRuntimeLib(const ArgList &Args, ArgStringList &CmdArgs,
void Darwin::addProfileRTLibs(const ArgList &Args,
ArgStringList &CmdArgs) const {
- if (!(Args.hasFlag(options::OPT_fprofile_arcs, options::OPT_fno_profile_arcs,
- false) ||
- Args.hasArg(options::OPT_fprofile_generate) ||
- Args.hasArg(options::OPT_fprofile_generate_EQ) ||
- Args.hasArg(options::OPT_fprofile_instr_generate) ||
- Args.hasArg(options::OPT_fprofile_instr_generate_EQ) ||
- Args.hasArg(options::OPT_fcreate_profile) ||
- Args.hasArg(options::OPT_coverage)))
- return;
+ if (!needsProfileRT(Args)) return;
// Select the appropriate runtime library for the target.
if (isTargetIOSBased())
@@ -317,6 +309,7 @@ void Darwin::addProfileRTLibs(const ArgList &Args,
else
AddLinkRuntimeLib(Args, CmdArgs, "libclang_rt.profile_osx.a",
/*AlwaysLink*/ true);
+ return;
}
void DarwinClang::AddLinkSanitizerLibArgs(const ArgList &Args,
OpenPOWER on IntegriCloud