r290303 - Driver: rename parameter to reduce confusion
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Wed Dec 21 19:09:00 PST 2016
Author: compnerd
Date: Wed Dec 21 21:09:00 2016
New Revision: 290303
URL: http://llvm.org/viewvc/llvm-project?rev=290303&view=rev
Log:
Driver: rename parameter to reduce confusion
The parameter to ParsePICOpts passed the effective triple and then used
that in a few places and used the actual triple in others. This was
slightly confusing. Rename the parameter to make it more obvious.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=290303&r1=290302&r2=290303&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Dec 21 21:09:00 2016
@@ -3789,10 +3789,8 @@ static void addPS4ProfileRTArgs(const To
/// 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 &Triple,
+ParsePICArgs(const ToolChain &ToolChain, const llvm::Triple &EffectiveTriple,
const ArgList &Args) {
- // FIXME: why does this code...and so much everywhere else, use both
- // ToolChain.getTriple() and Triple?
bool PIE = ToolChain.isPIEDefault();
bool PIC = PIE || ToolChain.isPICDefault();
// The Darwin/MachO default to use PIC does not apply when using -static.
@@ -3874,7 +3872,7 @@ ParsePICArgs(const ToolChain &ToolChain,
O.matches(options::OPT_fPIE) || O.matches(options::OPT_fPIC);
} else {
PIE = PIC = false;
- if (Triple.isPS4CPU()) {
+ if (EffectiveTriple.isPS4CPU()) {
Arg *ModelArg = Args.getLastArg(options::OPT_mcmodel_EQ);
StringRef Model = ModelArg ? ModelArg->getValue() : "";
if (Model != "kernel") {
@@ -3890,13 +3888,14 @@ ParsePICArgs(const ToolChain &ToolChain,
// 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() || Triple.isPS4CPU()))
+ if (PIC && (ToolChain.getTriple().isOSDarwin() || EffectiveTriple.isPS4CPU()))
IsPICLevelTwo |= ToolChain.isPICDefault();
// This kernel flags are a trump-card: they will disable PIC/PIE
// generation, independent of the argument order.
- if (KernelOrKext && ((!Triple.isiOS() || Triple.isOSVersionLT(6)) &&
- !Triple.isWatchOS()))
+ if (KernelOrKext &&
+ ((!EffectiveTriple.isiOS() || EffectiveTriple.isOSVersionLT(6)) &&
+ !EffectiveTriple.isWatchOS()))
PIC = PIE = false;
if (Arg *A = Args.getLastArg(options::OPT_mdynamic_no_pic)) {
More information about the cfe-commits
mailing list