summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2016-12-22 03:09:02 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2016-12-22 03:09:02 +0000
commit491d1d4b0029c44cdfbfe786411c5a3423d3ed4c (patch)
tree8fcf0274033277ed3fa75df7fd2306fc15ce7fc9 /clang/lib/Driver/Tools.cpp
parent416852fe37b840036eae7f2215eb517d9797430e (diff)
downloadbcm5719-llvm-491d1d4b0029c44cdfbfe786411c5a3423d3ed4c.tar.gz
bcm5719-llvm-491d1d4b0029c44cdfbfe786411c5a3423d3ed4c.zip
Driver: remove unnecessary parameter
We can query the Triple and EffectiveTriple from the ToolChain. Avoid passing in the argument and query it in the function. NFC. llvm-svn: 290304
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 445f13c95c3..8b52f52576d 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -3789,13 +3789,14 @@ static void addPS4ProfileRTArgs(const ToolChain &TC, const ArgList &Args,
/// this compile should be using PIC mode or not. Returns a tuple of
/// (RelocationModel, PICLevel, IsPIE).
static std::tuple<llvm::Reloc::Model, unsigned, bool>
-ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &EffectiveTriple,
- const ArgList &Args) {
+ParsePICArgs(const ToolChain &ToolChain, const ArgList &Args) {
+ const llvm::Triple &EffectiveTriple = ToolChain.getEffectiveTriple();
+ const llvm::Triple &Triple = ToolChain.getTriple();
+
bool PIE = ToolChain.isPIEDefault();
bool PIC = PIE || ToolChain.isPICDefault();
// The Darwin/MachO default to use PIC does not apply when using -static.
- if (ToolChain.getTriple().isOSBinFormatMachO() &&
- Args.hasArg(options::OPT_static))
+ if (Triple.isOSBinFormatMachO() && Args.hasArg(options::OPT_static))
PIE = PIC = false;
bool IsPICLevelTwo = PIC;
@@ -3803,7 +3804,7 @@ ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &EffectiveTriple,
Args.hasArg(options::OPT_mkernel, options::OPT_fapple_kext);
// Android-specific defaults for PIC/PIE
- if (ToolChain.getTriple().isAndroid()) {
+ if (Triple.isAndroid()) {
switch (ToolChain.getArch()) {
case llvm::Triple::arm:
case llvm::Triple::armeb:
@@ -3829,7 +3830,7 @@ ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &EffectiveTriple,
}
// OpenBSD-specific defaults for PIE
- if (ToolChain.getTriple().getOS() == llvm::Triple::OpenBSD) {
+ if (Triple.getOS() == llvm::Triple::OpenBSD) {
switch (ToolChain.getArch()) {
case llvm::Triple::mips64:
case llvm::Triple::mips64el:
@@ -3888,7 +3889,7 @@ ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &EffectiveTriple,
// Introduce a Darwin and PS4-specific hack. If the default is PIC, but the
// PIC level would've been set to level 1, force it back to level 2 PIC
// instead.
- if (PIC && (ToolChain.getTriple().isOSDarwin() || EffectiveTriple.isPS4CPU()))
+ if (PIC && (Triple.isOSDarwin() || EffectiveTriple.isPS4CPU()))
IsPICLevelTwo |= ToolChain.isPICDefault();
// This kernel flags are a trump-card: they will disable PIC/PIE
@@ -3901,9 +3902,9 @@ ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &EffectiveTriple,
if (Arg *A = Args.getLastArg(options::OPT_mdynamic_no_pic)) {
// This is a very special mode. It trumps the other modes, almost no one
// uses it, and it isn't even valid on any OS but Darwin.
- if (!ToolChain.getTriple().isOSDarwin())
+ if (!Triple.isOSDarwin())
ToolChain.getDriver().Diag(diag::err_drv_unsupported_opt_for_target)
- << A->getSpelling() << ToolChain.getTriple().str();
+ << A->getSpelling() << Triple.str();
// FIXME: Warn when this flag trumps some other PIC or PIE flag.
@@ -3933,14 +3934,14 @@ ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &EffectiveTriple,
if (LastROPIArg && LastROPIArg->getOption().matches(options::OPT_fropi)) {
if (!EmbeddedPISupported)
ToolChain.getDriver().Diag(diag::err_drv_unsupported_opt_for_target)
- << LastROPIArg->getSpelling() << ToolChain.getTriple().str();
+ << LastROPIArg->getSpelling() << Triple.str();
ROPI = true;
}
Arg *LastRWPIArg = Args.getLastArg(options::OPT_frwpi, options::OPT_fno_rwpi);
if (LastRWPIArg && LastRWPIArg->getOption().matches(options::OPT_frwpi)) {
if (!EmbeddedPISupported)
ToolChain.getDriver().Diag(diag::err_drv_unsupported_opt_for_target)
- << LastRWPIArg->getSpelling() << ToolChain.getTriple().str();
+ << LastRWPIArg->getSpelling() << Triple.str();
RWPI = true;
}
@@ -3986,8 +3987,7 @@ static void AddAssemblerKPIC(const ToolChain &ToolChain, const ArgList &Args,
llvm::Reloc::Model RelocationModel;
unsigned PICLevel;
bool IsPIE;
- std::tie(RelocationModel, PICLevel, IsPIE) =
- ParsePICArgs(ToolChain, ToolChain.getTriple(), Args);
+ std::tie(RelocationModel, PICLevel, IsPIE) = ParsePICArgs(ToolChain, Args);
if (RelocationModel != llvm::Reloc::Static)
CmdArgs.push_back("-KPIC");
@@ -4329,7 +4329,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
unsigned PICLevel;
bool IsPIE;
std::tie(RelocationModel, PICLevel, IsPIE) =
- ParsePICArgs(getToolChain(), Triple, Args);
+ ParsePICArgs(getToolChain(), Args);
const char *RMName = RelocationModelName(RelocationModel);
@@ -7036,7 +7036,7 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
unsigned PICLevel;
bool IsPIE;
std::tie(RelocationModel, PICLevel, IsPIE) =
- ParsePICArgs(getToolChain(), Triple, Args);
+ ParsePICArgs(getToolChain(), Args);
const char *RMName = RelocationModelName(RelocationModel);
if (RMName) {
@@ -9666,15 +9666,13 @@ void gnutools::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
const char *LinkingOutput) const {
claimNoWarnArgs(Args);
- const llvm::Triple &Triple = getToolChain().getEffectiveTriple();
-
ArgStringList CmdArgs;
llvm::Reloc::Model RelocationModel;
unsigned PICLevel;
bool IsPIE;
std::tie(RelocationModel, PICLevel, IsPIE) =
- ParsePICArgs(getToolChain(), Triple, Args);
+ ParsePICArgs(getToolChain(), Args);
switch (getToolChain().getArch()) {
default:
OpenPOWER on IntegriCloud