Remove first argument from Arg::getValue; it's been unused since r105760.

llvm-svn: 167211
This commit is contained in:
Richard Smith 2012-11-01 04:30:05 +00:00
parent 33fd551258
commit bd55daf2ee
9 changed files with 179 additions and 179 deletions

View File

@ -96,7 +96,7 @@ namespace driver {
void claim() const { getBaseArg().Claimed = true; }
unsigned getNumValues() const { return Values.size(); }
const char *getValue(const ArgList &Args, unsigned N=0) const {
const char *getValue(unsigned N = 0) const {
return Values[N];
}

View File

@ -85,14 +85,14 @@ void Arg::renderAsInput(const ArgList &Args, ArgStringList &Output) const {
}
for (unsigned i = 0, e = getNumValues(); i != e; ++i)
Output.push_back(getValue(Args, i));
Output.push_back(getValue(i));
}
void Arg::render(const ArgList &Args, ArgStringList &Output) const {
switch (getOption().getRenderStyle()) {
case Option::RenderValuesStyle:
for (unsigned i = 0, e = getNumValues(); i != e; ++i)
Output.push_back(getValue(Args, i));
Output.push_back(getValue(i));
break;
case Option::RenderCommaJoinedStyle: {
@ -101,7 +101,7 @@ void Arg::render(const ArgList &Args, ArgStringList &Output) const {
OS << getSpelling();
for (unsigned i = 0, e = getNumValues(); i != e; ++i) {
if (i) OS << ',';
OS << getValue(Args, i);
OS << getValue(i);
}
Output.push_back(Args.MakeArgString(OS.str()));
break;
@ -109,15 +109,15 @@ void Arg::render(const ArgList &Args, ArgStringList &Output) const {
case Option::RenderJoinedStyle:
Output.push_back(Args.GetOrMakeJoinedArgString(
getIndex(), getSpelling(), getValue(Args, 0)));
getIndex(), getSpelling(), getValue(0)));
for (unsigned i = 1, e = getNumValues(); i != e; ++i)
Output.push_back(getValue(Args, i));
Output.push_back(getValue(i));
break;
case Option::RenderSeparateStyle:
Output.push_back(Args.MakeArgString(getSpelling()));
for (unsigned i = 0, e = getNumValues(); i != e; ++i)
Output.push_back(getValue(Args, i));
Output.push_back(getValue(i));
break;
}
}

View File

@ -211,7 +211,7 @@ bool ArgList::hasFlag(OptSpecifier Pos, OptSpecifier Neg, bool Default) const {
StringRef ArgList::getLastArgValue(OptSpecifier Id,
StringRef Default) const {
if (Arg *A = getLastArg(Id))
return A->getValue(*this);
return A->getValue();
return Default;
}
@ -220,10 +220,10 @@ int ArgList::getLastArgIntValue(OptSpecifier Id, int Default,
int Res = Default;
if (Arg *A = getLastArg(Id)) {
if (StringRef(A->getValue(*this)).getAsInteger(10, Res)) {
if (StringRef(A->getValue()).getAsInteger(10, Res)) {
if (Diags)
Diags->Report(diag::err_drv_invalid_int_value)
<< A->getAsString(*this) << A->getValue(*this);
<< A->getAsString(*this) << A->getValue();
}
}
@ -258,7 +258,7 @@ void ArgList::AddAllArgValues(ArgStringList &Output, OptSpecifier Id0,
ie = filtered_end(); it != ie; ++it) {
(*it)->claim();
for (unsigned i = 0, e = (*it)->getNumValues(); i != e; ++i)
Output.push_back((*it)->getValue(*this, i));
Output.push_back((*it)->getValue(i));
}
}
@ -271,10 +271,10 @@ void ArgList::AddAllArgsTranslated(ArgStringList &Output, OptSpecifier Id0,
if (Joined) {
Output.push_back(MakeArgString(StringRef(Translation) +
(*it)->getValue(*this, 0)));
(*it)->getValue(0)));
} else {
Output.push_back(Translation);
Output.push_back((*it)->getValue(*this, 0));
Output.push_back((*it)->getValue(0));
}
}
}

View File

@ -174,9 +174,9 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
// Add the remaining values as Xlinker arguments.
for (unsigned i = 0, e = A->getNumValues(); i != e; ++i)
if (StringRef(A->getValue(Args, i)) != "--no-demangle")
if (StringRef(A->getValue(i)) != "--no-demangle")
DAL->AddSeparateArg(A, Opts->getOption(options::OPT_Xlinker),
A->getValue(Args, i));
A->getValue(i));
continue;
}
@ -186,21 +186,21 @@ DerivedArgList *Driver::TranslateInputArgs(const InputArgList &Args) const {
// care to encourage this usage model.
if (A->getOption().matches(options::OPT_Wp_COMMA) &&
A->getNumValues() == 2 &&
(A->getValue(Args, 0) == StringRef("-MD") ||
A->getValue(Args, 0) == StringRef("-MMD"))) {
(A->getValue(0) == StringRef("-MD") ||
A->getValue(0) == StringRef("-MMD"))) {
// Rewrite to -MD/-MMD along with -MF.
if (A->getValue(Args, 0) == StringRef("-MD"))
if (A->getValue(0) == StringRef("-MD"))
DAL->AddFlagArg(A, Opts->getOption(options::OPT_MD));
else
DAL->AddFlagArg(A, Opts->getOption(options::OPT_MMD));
DAL->AddSeparateArg(A, Opts->getOption(options::OPT_MF),
A->getValue(Args, 1));
A->getValue(1));
continue;
}
// Rewrite reserved library names.
if (A->getOption().matches(options::OPT_l)) {
StringRef Value = A->getValue(Args);
StringRef Value = A->getValue();
// Rewrite unless -nostdlib is present.
if (!HasNostdlib && Value == "stdc++") {
@ -273,23 +273,23 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
CCCIsCXX = Args->hasArg(options::OPT_ccc_cxx) || CCCIsCXX;
CCCEcho = Args->hasArg(options::OPT_ccc_echo);
if (const Arg *A = Args->getLastArg(options::OPT_ccc_gcc_name))
CCCGenericGCCName = A->getValue(*Args);
CCCGenericGCCName = A->getValue();
CCCUsePCH = Args->hasFlag(options::OPT_ccc_pch_is_pch,
options::OPT_ccc_pch_is_pth);
// FIXME: DefaultTargetTriple is used by the target-prefixed calls to as/ld
// and getToolChain is const.
if (const Arg *A = Args->getLastArg(options::OPT_target))
DefaultTargetTriple = A->getValue(*Args);
DefaultTargetTriple = A->getValue();
if (const Arg *A = Args->getLastArg(options::OPT_ccc_install_dir))
Dir = InstalledDir = A->getValue(*Args);
Dir = InstalledDir = A->getValue();
for (arg_iterator it = Args->filtered_begin(options::OPT_B),
ie = Args->filtered_end(); it != ie; ++it) {
const Arg *A = *it;
A->claim();
PrefixDirs.push_back(A->getValue(*Args, 0));
PrefixDirs.push_back(A->getValue(0));
}
if (const Arg *A = Args->getLastArg(options::OPT__sysroot_EQ))
SysRoot = A->getValue(*Args);
SysRoot = A->getValue();
if (Args->hasArg(options::OPT_nostdlib))
UseStdLib = false;
@ -381,7 +381,7 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
bool IgnoreInput = false;
// Ignore input from stdin or any inputs that cannot be preprocessed.
if (!strcmp(it->second->getValue(C.getArgs()), "-")) {
if (!strcmp(it->second->getValue(), "-")) {
Diag(clang::diag::note_drv_command_failed_diag_msg)
<< "Error generating preprocessed source(s) - ignoring input from stdin"
".";
@ -405,7 +405,7 @@ void Driver::generateCompilationDiagnostics(Compilation &C,
it != ie; ++it) {
Arg *A = *it;
if (A->getOption().matches(options::OPT_arch)) {
StringRef ArchName = A->getValue(C.getArgs());
StringRef ArchName = A->getValue();
ArchNames.insert(ArchName);
}
}
@ -556,7 +556,7 @@ void Driver::PrintOptions(const ArgList &Args) const {
for (unsigned j = 0; j < A->getNumValues(); ++j) {
if (j)
llvm::errs() << ", ";
llvm::errs() << '"' << A->getValue(Args, j) << '"';
llvm::errs() << '"' << A->getValue(j) << '"';
}
llvm::errs() << "}\n";
}
@ -662,12 +662,12 @@ bool Driver::HandleImmediateArgs(const Compilation &C) {
// FIXME: The following handlers should use a callback mechanism, we don't
// know what the client would like to do.
if (Arg *A = C.getArgs().getLastArg(options::OPT_print_file_name_EQ)) {
llvm::outs() << GetFilePath(A->getValue(C.getArgs()), TC) << "\n";
llvm::outs() << GetFilePath(A->getValue(), TC) << "\n";
return false;
}
if (Arg *A = C.getArgs().getLastArg(options::OPT_print_prog_name_EQ)) {
llvm::outs() << GetProgramPath(A->getValue(C.getArgs()), TC) << "\n";
llvm::outs() << GetProgramPath(A->getValue(), TC) << "\n";
return false;
}
@ -730,7 +730,7 @@ static unsigned PrintActions1(const Compilation &C, Action *A,
os << Action::getClassName(A->getKind()) << ", ";
if (InputAction *IA = dyn_cast<InputAction>(A)) {
os << "\"" << IA->getInputArg().getValue(C.getArgs()) << "\"";
os << "\"" << IA->getInputArg().getValue() << "\"";
} else if (BindArchAction *BIA = dyn_cast<BindArchAction>(A)) {
os << '"' << BIA->getArchName() << '"'
<< ", {" << PrintActions1(C, *BIA->begin(), Ids) << "}";
@ -790,7 +790,7 @@ void Driver::BuildUniversalActions(const ToolChain &TC,
// Validate the option here; we don't save the type here because its
// particular spelling may participate in other driver choices.
llvm::Triple::ArchType Arch =
tools::darwin::getArchTypeForDarwinArchName(A->getValue(Args));
tools::darwin::getArchTypeForDarwinArchName(A->getValue());
if (Arch == llvm::Triple::UnknownArch) {
Diag(clang::diag::err_drv_invalid_arch_name)
<< A->getAsString(Args);
@ -798,8 +798,8 @@ void Driver::BuildUniversalActions(const ToolChain &TC,
}
A->claim();
if (ArchNames.insert(A->getValue(Args)))
Archs.push_back(A->getValue(Args));
if (ArchNames.insert(A->getValue()))
Archs.push_back(A->getValue());
}
}
@ -894,7 +894,7 @@ void Driver::BuildInputs(const ToolChain &TC, const DerivedArgList &Args,
Arg *A = *it;
if (A->getOption().getKind() == Option::InputClass) {
const char *Value = A->getValue(Args);
const char *Value = A->getValue();
types::ID Ty = types::TY_INVALID;
// Infer the input type if necessary.
@ -962,7 +962,7 @@ void Driver::BuildInputs(const ToolChain &TC, const DerivedArgList &Args,
SmallString<64> Path(Value);
if (Arg *WorkDir = Args.getLastArg(options::OPT_working_directory)) {
if (!llvm::sys::path::is_absolute(Path.str())) {
SmallString<64> Directory(WorkDir->getValue(Args));
SmallString<64> Directory(WorkDir->getValue());
llvm::sys::path::append(Directory, Value);
Path.assign(Directory);
}
@ -983,14 +983,14 @@ void Driver::BuildInputs(const ToolChain &TC, const DerivedArgList &Args,
} else if (A->getOption().matches(options::OPT_x)) {
InputTypeArg = A;
InputType = types::lookupTypeForTypeSpecifier(A->getValue(Args));
InputType = types::lookupTypeForTypeSpecifier(A->getValue());
A->claim();
// Follow gcc behavior and treat as linker input for invalid -x
// options. Its not clear why we shouldn't just revert to unknown; but
// this isn't very important, we might as well be bug compatible.
if (!InputType) {
Diag(clang::diag::err_drv_unknown_language) << A->getValue(Args);
Diag(clang::diag::err_drv_unknown_language) << A->getValue();
InputType = types::TY_Object;
}
}
@ -1213,7 +1213,7 @@ void Driver::BuildJobs(Compilation &C) const {
const char *LinkingOutput = 0;
if (isa<LipoJobAction>(A)) {
if (FinalOutput)
LinkingOutput = FinalOutput->getValue(C.getArgs());
LinkingOutput = FinalOutput->getValue();
else
LinkingOutput = DefaultImageName.c_str();
}
@ -1326,7 +1326,7 @@ void Driver::BuildJobsForAction(Compilation &C,
const Arg &Input = IA->getInputArg();
Input.claim();
if (Input.getOption().matches(options::OPT_INPUT)) {
const char *Name = Input.getValue(C.getArgs());
const char *Name = Input.getValue();
Result = InputInfo(Name, A->getType(), Name);
} else
Result = InputInfo(&Input, A->getType(), "");
@ -1415,7 +1415,7 @@ const char *Driver::GetNamedOutputPath(Compilation &C,
if (AtTopLevel && !isa<DsymutilJobAction>(JA) &&
!isa<VerifyJobAction>(JA)) {
if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o))
return C.addResultFile(FinalOutput->getValue(C.getArgs()));
return C.addResultFile(FinalOutput->getValue());
}
// Default to writing to stdout?
@ -1614,7 +1614,7 @@ static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple,
StringRef DarwinArchName) {
// FIXME: Already done in Compilation *Driver::BuildCompilation
if (const Arg *A = Args.getLastArg(options::OPT_target))
DefaultTargetTriple = A->getValue(Args);
DefaultTargetTriple = A->getValue();
llvm::Triple Target(llvm::Triple::normalize(DefaultTargetTriple));
@ -1630,7 +1630,7 @@ static llvm::Triple computeTargetTriple(StringRef DefaultTargetTriple,
// Handle the Darwin '-arch' flag.
if (Arg *A = Args.getLastArg(options::OPT_arch)) {
llvm::Triple::ArchType DarwinArch
= tools::darwin::getArchTypeForDarwinArchName(A->getValue(Args));
= tools::darwin::getArchTypeForDarwinArchName(A->getValue());
if (DarwinArch != llvm::Triple::UnknownArch)
Target.setArch(DarwinArch);
}

View File

@ -71,13 +71,13 @@ static const char *getARMTargetCPU(const ArgList &Args,
// FIXME: Warn on inconsistent use of -mcpu and -march.
// If we have -mcpu=, use that.
if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
return A->getValue(Args);
return A->getValue();
}
StringRef MArch;
if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
// Otherwise, if we have -march= choose the base CPU for that arch.
MArch = A->getValue(Args);
MArch = A->getValue();
} else {
// Otherwise, use the Arch from the triple.
MArch = Triple.getArchName();
@ -189,7 +189,7 @@ ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
const ArgList &Args) const
{
if (Arg *A = Args.getLastArg(options::OPT_rtlib_EQ)) {
StringRef Value = A->getValue(Args);
StringRef Value = A->getValue();
if (Value == "compiler-rt")
return ToolChain::RLT_CompilerRT;
if (Value == "libgcc")
@ -203,7 +203,7 @@ ToolChain::RuntimeLibType ToolChain::GetRuntimeLibType(
ToolChain::CXXStdlibType ToolChain::GetCXXStdlibType(const ArgList &Args) const{
if (Arg *A = Args.getLastArg(options::OPT_stdlib_EQ)) {
StringRef Value = A->getValue(Args);
StringRef Value = A->getValue();
if (Value == "libc++")
return ToolChain::CST_Libcxx;
if (Value == "libstdc++")

View File

@ -140,11 +140,11 @@ StringRef Darwin::getDarwinArchName(const ArgList &Args) const {
case llvm::Triple::thumb:
case llvm::Triple::arm: {
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ))
if (const char *Arch = GetArmArchForMArch(A->getValue(Args)))
if (const char *Arch = GetArmArchForMArch(A->getValue()))
return Arch;
if (const Arg *A = Args.getLastArg(options::OPT_mcpu_EQ))
if (const char *Arch = GetArmArchForMCpu(A->getValue(Args)))
if (const char *Arch = GetArmArchForMCpu(A->getValue()))
return Arch;
return "arm";
@ -326,7 +326,7 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
break;
default:
getDriver().Diag(diag::err_drv_unsupported_rtlib_for_platform)
<< Args.getLastArg(options::OPT_rtlib_EQ)->getValue(Args) << "darwin";
<< Args.getLastArg(options::OPT_rtlib_EQ)->getValue() << "darwin";
return;
}
@ -476,7 +476,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
if (!iOSVersion && !iOSSimVersion) {
for (arg_iterator it = Args.filtered_begin(options::OPT_D),
ie = Args.filtered_end(); it != ie; ++it) {
StringRef define = (*it)->getValue(Args);
StringRef define = (*it)->getValue();
if (define.startswith(SimulatorVersionDefineName())) {
unsigned Major = 0, Minor = 0, Micro = 0;
if (GetVersionFromSimulatorDefine(define, Major, Minor, Micro) &&
@ -522,7 +522,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
if (iOSTarget.empty()) {
if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
StringRef first, second;
StringRef isysroot = A->getValue(Args);
StringRef isysroot = A->getValue();
llvm::tie(first, second) = isysroot.split(StringRef("SDKs/iPhoneOS"));
if (second != "")
iOSTarget = second.substr(0,3);
@ -591,7 +591,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
bool HadExtra;
if (OSXVersion) {
assert((!iOSVersion && !iOSSimVersion) && "Unknown target platform!");
if (!Driver::GetReleaseVersion(OSXVersion->getValue(Args), Major, Minor,
if (!Driver::GetReleaseVersion(OSXVersion->getValue(), Major, Minor,
Micro, HadExtra) || HadExtra ||
Major != 10 || Minor >= 100 || Micro >= 100)
getDriver().Diag(diag::err_drv_invalid_version_number)
@ -599,7 +599,7 @@ void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
} else {
const Arg *Version = iOSVersion ? iOSVersion : iOSSimVersion;
assert(Version && "Unknown target platform!");
if (!Driver::GetReleaseVersion(Version->getValue(Args), Major, Minor,
if (!Driver::GetReleaseVersion(Version->getValue(), Major, Minor,
Micro, HadExtra) || HadExtra ||
Major >= 10 || Minor >= 100 || Micro >= 100)
getDriver().Diag(diag::err_drv_invalid_version_number)
@ -637,7 +637,7 @@ void DarwinClang::AddCXXStdlibLibArgs(const ArgList &Args,
// Check in the sysroot first.
bool Exists;
if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
llvm::sys::Path P(A->getValue(Args));
llvm::sys::Path P(A->getValue());
P.appendComponent("usr");
P.appendComponent("lib");
P.appendComponent("libstdc++.dylib");
@ -714,14 +714,14 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
// Skip this argument unless the architecture matches either the toolchain
// triple arch, or the arch being bound.
llvm::Triple::ArchType XarchArch =
tools::darwin::getArchTypeForDarwinArchName(A->getValue(Args, 0));
tools::darwin::getArchTypeForDarwinArchName(A->getValue(0));
if (!(XarchArch == getArch() ||
(BoundArch && XarchArch ==
tools::darwin::getArchTypeForDarwinArchName(BoundArch))))
continue;
Arg *OriginalArg = A;
unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(Args, 1));
unsigned Index = Args.getBaseArgs().MakeIndex(A->getValue(1));
unsigned Prev = Index;
Arg *XarchArg = Opts.ParseOneArg(Args, Index);
@ -756,7 +756,7 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) {
DAL->AddSeparateArg(OriginalArg,
Opts.getOption(options::OPT_Zlinker_input),
A->getValue(Args, i));
A->getValue(i));
}
continue;
@ -779,7 +779,7 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
case options::OPT_dependency_file:
DAL->AddSeparateArg(A, Opts.getOption(options::OPT_MF),
A->getValue(Args));
A->getValue());
break;
case options::OPT_gfull:
@ -1068,7 +1068,7 @@ bool Generic_GCC::GCCVersion::operator<(const GCCVersion &RHS) const {
static StringRef getGCCToolchainDir(const ArgList &Args) {
const Arg *A = Args.getLastArg(options::OPT_gcc_toolchain);
if (A)
return A->getValue(Args);
return A->getValue();
return GCC_INSTALL_PREFIX;
}
@ -1326,7 +1326,7 @@ Generic_GCC::GCCInstallationDetector::GCCInstallationDetector(
// FIXME: There is the same routine in the Tools.cpp.
static bool hasMipsN32ABIArg(const ArgList &Args) {
Arg *A = Args.getLastArg(options::OPT_mabi_EQ);
return A && (A->getValue(Args) == StringRef("n32"));
return A && (A->getValue() == StringRef("n32"));
}
static StringRef getTargetMultiarchSuffix(llvm::Triple::ArchType TargetArch,
@ -2139,7 +2139,7 @@ static bool isMipsR2Arch(llvm::Triple::ArchType Arch,
if (A->getOption().matches(options::OPT_mips_CPUs_Group))
return A->getOption().matches(options::OPT_mips32r2);
return A->getValue(Args) == StringRef("mips32r2");
return A->getValue() == StringRef("mips32r2");
}
static StringRef getMultilibDir(const llvm::Triple &Triple,

View File

@ -248,7 +248,7 @@ void Clang::AddPreprocessingOptions(Compilation &C,
// Determine the output location.
const char *DepFile;
if (Arg *MF = Args.getLastArg(options::OPT_MF)) {
DepFile = MF->getValue(Args);
DepFile = MF->getValue();
C.addFailureResultFile(DepFile);
} else if (Output.getType() == types::TY_Dependencies) {
DepFile = Output.getFilename();
@ -270,7 +270,7 @@ void Clang::AddPreprocessingOptions(Compilation &C,
// when we are only generating a dependency file.
Arg *OutputOpt = Args.getLastArg(options::OPT_o);
if (OutputOpt && Output.getType() != types::TY_Dependencies) {
DepTarget = OutputOpt->getValue(Args);
DepTarget = OutputOpt->getValue();
} else {
// Otherwise derive from the base input.
//
@ -310,7 +310,7 @@ void Clang::AddPreprocessingOptions(Compilation &C,
if (A->getOption().matches(options::OPT_MQ)) {
CmdArgs.push_back("-MT");
SmallString<128> Quoted;
QuoteTarget(A->getValue(Args), Quoted);
QuoteTarget(A->getValue(), Quoted);
CmdArgs.push_back(Args.MakeArgString(Quoted));
// -MT flag - no change
@ -338,7 +338,7 @@ void Clang::AddPreprocessingOptions(Compilation &C,
bool FoundPTH = false;
bool FoundPCH = false;
llvm::sys::Path P(A->getValue(Args));
llvm::sys::Path P(A->getValue());
bool Exists;
if (UsePCH) {
P.appendSuffix("pch");
@ -488,7 +488,7 @@ static std::string getARMTargetCPU(const ArgList &Args,
// If we have -mcpu=, use that.
if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
StringRef MCPU = A->getValue(Args);
StringRef MCPU = A->getValue();
// Handle -mcpu=native.
if (MCPU == "native")
return llvm::sys::getHostCPUName();
@ -499,7 +499,7 @@ static std::string getARMTargetCPU(const ArgList &Args,
StringRef MArch;
if (Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
// Otherwise, if we have -march= choose the base CPU for that arch.
MArch = A->getValue(Args);
MArch = A->getValue();
} else {
// Otherwise, use the Arch from the triple.
MArch = Triple.getArchName();
@ -563,7 +563,7 @@ static bool isSignedCharDefault(const llvm::Triple &Triple) {
// frontend target.
static void addFPUArgs(const Driver &D, const Arg *A, const ArgList &Args,
ArgStringList &CmdArgs) {
StringRef FPU = A->getValue(Args);
StringRef FPU = A->getValue();
// Set the target features based on the FPU.
if (FPU == "fpa" || FPU == "fpe2" || FPU == "fpe3" || FPU == "maverick") {
@ -601,7 +601,7 @@ static void addFPUArgs(const Driver &D, const Arg *A, const ArgList &Args,
// Handle -mfpmath=.
static void addFPMathArgs(const Driver &D, const Arg *A, const ArgList &Args,
ArgStringList &CmdArgs, StringRef CPU) {
StringRef FPMath = A->getValue(Args);
StringRef FPMath = A->getValue();
// Set the target features based on the FPMath.
if (FPMath == "neon") {
@ -636,7 +636,7 @@ static StringRef getARMFloatABI(const Driver &D,
else if (A->getOption().matches(options::OPT_mhard_float))
FloatABI = "hard";
else {
FloatABI = A->getValue(Args);
FloatABI = A->getValue();
if (FloatABI != "soft" && FloatABI != "softfp" && FloatABI != "hard") {
D.Diag(diag::err_drv_invalid_mfloat_abi)
<< A->getAsString(Args);
@ -712,7 +712,7 @@ void Clang::AddARMTargetArgs(const ArgList &Args,
// FIXME: Support -meabi.
const char *ABIName = 0;
if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ)) {
ABIName = A->getValue(Args);
ABIName = A->getValue();
} else if (Triple.isOSDarwin()) {
// The backend is hardwired to assume AAPCS for M-class processors, ensure
// the frontend matches that.
@ -852,11 +852,11 @@ static void getMipsCPUAndABI(const ArgList &Args,
if (A->getOption().matches(options::OPT_mips_CPUs_Group))
CPUName = getMipsCPUFromAlias(*A);
else
CPUName = A->getValue(Args);
CPUName = A->getValue();
}
if (Arg *A = Args.getLastArg(options::OPT_mabi_EQ))
ABIName = A->getValue(Args);
ABIName = A->getValue();
// Setup default CPU and ABI names.
if (CPUName.empty() && ABIName.empty()) {
@ -906,7 +906,7 @@ static StringRef getMipsFloatABI(const Driver &D, const ArgList &Args) {
else if (A->getOption().matches(options::OPT_mhard_float))
FloatABI = "hard";
else {
FloatABI = A->getValue(Args);
FloatABI = A->getValue();
if (FloatABI != "soft" && FloatABI != "single" && FloatABI != "hard") {
D.Diag(diag::err_drv_invalid_mfloat_abi) << A->getAsString(Args);
FloatABI = "hard";
@ -990,7 +990,7 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args,
"dspr2");
if (Arg *A = Args.getLastArg(options::OPT_G)) {
StringRef v = A->getValue(Args);
StringRef v = A->getValue();
CmdArgs.push_back("-mllvm");
CmdArgs.push_back(Args.MakeArgString("-mips-ssection-threshold=" + v));
A->claim();
@ -1000,7 +1000,7 @@ void Clang::AddMIPSTargetArgs(const ArgList &Args,
/// getPPCTargetCPU - Get the (LLVM) name of the PowerPC cpu we are targeting.
static std::string getPPCTargetCPU(const ArgList &Args) {
if (Arg *A = Args.getLastArg(options::OPT_mcpu_EQ)) {
StringRef CPUName = A->getValue(Args);
StringRef CPUName = A->getValue();
if (CPUName == "native") {
std::string CPU = llvm::sys::getHostCPUName();
@ -1071,7 +1071,7 @@ void Clang::AddSparcTargetArgs(const ArgList &Args,
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
CmdArgs.push_back("-target-cpu");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
// Select the float ABI as determined by -msoft-float, -mhard-float, and
@ -1124,7 +1124,7 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
const char *CPUName = 0;
if (const Arg *A = Args.getLastArg(options::OPT_march_EQ)) {
if (StringRef(A->getValue(Args)) == "native") {
if (StringRef(A->getValue()) == "native") {
// FIXME: Reject attempts to use -march=native unless the target matches
// the host.
//
@ -1134,7 +1134,7 @@ void Clang::AddX86TargetArgs(const ArgList &Args,
if (!CPU.empty() && CPU != "generic")
CPUName = Args.MakeArgString(CPU);
} else
CPUName = A->getValue(Args);
CPUName = A->getValue();
}
// Select the default CPU if none was given (or detection failed).
@ -1230,7 +1230,7 @@ static Arg* getLastHexagonArchArg (const ArgList &Args)
A->claim();
}
else if ((*it)->getOption().matches(options::OPT_m_Joined)){
StringRef Value = (*it)->getValue(Args,0);
StringRef Value = (*it)->getValue(0);
if (Value.startswith("v")) {
A = *it;
A->claim();
@ -1247,7 +1247,7 @@ static StringRef getHexagonTargetCPU(const ArgList &Args)
// Select the default CPU (v4) if none was given or detection failed.
if ((A = getLastHexagonArchArg (Args))) {
WhichHexagon = A->getValue(Args);
WhichHexagon = A->getValue();
if (WhichHexagon == "")
return "v4";
else
@ -1272,7 +1272,7 @@ void Clang::AddHexagonTargetArgs(const ArgList &Args,
if (Arg *A = Args.getLastArg(options::OPT_G,
options::OPT_msmall_data_threshold_EQ)) {
std::string SmallDataThreshold="-small-data-threshold=";
SmallDataThreshold += A->getValue(Args);
SmallDataThreshold += A->getValue();
CmdArgs.push_back ("-mllvm");
CmdArgs.push_back(Args.MakeArgString(SmallDataThreshold));
A->claim();
@ -1588,7 +1588,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
A->claim();
for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) {
StringRef Value = A->getValue(Args, i);
StringRef Value = A->getValue(i);
if (Value == "-force_cpusubtype_ALL") {
// Do nothing, this is the default and we don't support anything else.
@ -1697,7 +1697,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// reasons.
CmdArgs.push_back("-analyzer-output");
if (Arg *A = Args.getLastArg(options::OPT__analyzer_output))
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
else
CmdArgs.push_back("plist");
@ -1787,7 +1787,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_mregparm_EQ)) {
CmdArgs.push_back("-mregparm");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
if (Args.hasFlag(options::OPT_mrtd, options::OPT_mno_rtd, false))
@ -1903,7 +1903,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
options::OPT_fno_fast_math,
options::OPT_ffp_contract)) {
if (A->getOption().getID() == options::OPT_ffp_contract) {
StringRef Val = A->getValue(Args);
StringRef Val = A->getValue();
if (Val == "fast" || Val == "on" || Val == "off") {
CmdArgs.push_back(Args.MakeArgString("-ffp-contract=" + Val));
} else {
@ -1975,7 +1975,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_flimited_precision_EQ)) {
CmdArgs.push_back("-mlimit-float-precision");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
// FIXME: Handle -mtune=.
@ -1983,7 +1983,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_mcmodel_EQ)) {
CmdArgs.push_back("-mcode-model");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
// Add target specific cpu and features flags.
@ -2027,7 +2027,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Pass the linker version in use.
if (Arg *A = Args.getLastArg(options::OPT_mlinker_version_EQ)) {
CmdArgs.push_back("-target-linker-version");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
// -mno-omit-leaf-frame-pointer is the default on Darwin.
@ -2141,7 +2141,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
case options::OPT_ccc_arcmt_migrate:
CmdArgs.push_back("-arcmt-migrate");
CmdArgs.push_back("-mt-migrate-directory");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
Args.AddLastArg(CmdArgs, options::OPT_arcmt_migrate_report_output);
Args.AddLastArg(CmdArgs, options::OPT_arcmt_migrate_emit_arc_errors);
@ -2156,7 +2156,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
<< A->getAsString(Args) << "-ccc-arcmt-migrate";
}
CmdArgs.push_back("-mt-migrate-directory");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
if (!Args.hasArg(options::OPT_objcmt_migrate_literals,
options::OPT_objcmt_migrate_subscripting)) {
@ -2188,7 +2188,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (A->getOption().matches(options::OPT_O4))
CmdArgs.push_back("-O3");
else if (A->getOption().matches(options::OPT_O) &&
A->getValue(Args)[0] == '\0')
A->getValue()[0] == '\0')
CmdArgs.push_back("-O2");
else
A->render(Args, CmdArgs);
@ -2279,18 +2279,18 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_ftemplate_depth_,
options::OPT_ftemplate_depth_EQ)) {
CmdArgs.push_back("-ftemplate-depth");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
if (Arg *A = Args.getLastArg(options::OPT_fconstexpr_depth_EQ)) {
CmdArgs.push_back("-fconstexpr-depth");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
if (Arg *A = Args.getLastArg(options::OPT_Wlarge_by_value_copy_EQ,
options::OPT_Wlarge_by_value_copy_def)) {
if (A->getNumValues()) {
StringRef bytes = A->getValue(Args);
StringRef bytes = A->getValue();
CmdArgs.push_back(Args.MakeArgString("-Wlarge-by-value-copy=" + bytes));
} else
CmdArgs.push_back("-Wlarge-by-value-copy=64"); // default value
@ -2299,7 +2299,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_fbounds_checking,
options::OPT_fbounds_checking_EQ)) {
if (A->getNumValues()) {
StringRef val = A->getValue(Args);
StringRef val = A->getValue();
CmdArgs.push_back(Args.MakeArgString("-fbounds-checking=" + val));
} else
CmdArgs.push_back("-fbounds-checking=1");
@ -2310,39 +2310,39 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_fconstant_string_class_EQ)) {
CmdArgs.push_back("-fconstant-string-class");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
if (Arg *A = Args.getLastArg(options::OPT_ftabstop_EQ)) {
CmdArgs.push_back("-ftabstop");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
CmdArgs.push_back("-ferror-limit");
if (Arg *A = Args.getLastArg(options::OPT_ferror_limit_EQ))
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
else
CmdArgs.push_back("19");
if (Arg *A = Args.getLastArg(options::OPT_fmacro_backtrace_limit_EQ)) {
CmdArgs.push_back("-fmacro-backtrace-limit");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
if (Arg *A = Args.getLastArg(options::OPT_ftemplate_backtrace_limit_EQ)) {
CmdArgs.push_back("-ftemplate-backtrace-limit");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
if (Arg *A = Args.getLastArg(options::OPT_fconstexpr_backtrace_limit_EQ)) {
CmdArgs.push_back("-fconstexpr-backtrace-limit");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
// Pass -fmessage-length=.
CmdArgs.push_back("-fmessage-length");
if (Arg *A = Args.getLastArg(options::OPT_fmessage_length_EQ)) {
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
} else {
// If -fmessage-length=N was not specified, determine whether this is a
// terminal and, if so, implicitly define -fmessage-length appropriately.
@ -2352,7 +2352,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (const Arg *A = Args.getLastArg(options::OPT_fvisibility_EQ)) {
CmdArgs.push_back("-fvisibility");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
Args.AddLastArg(CmdArgs, options::OPT_fvisibility_inlines_hidden);
@ -2413,7 +2413,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (Arg *A = Args.getLastArg(options::OPT_ftrapv_handler_EQ)) {
CmdArgs.push_back("-ftrapv-handler");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
Args.AddLastArg(CmdArgs, options::OPT_ftrap_function_EQ);
@ -2456,7 +2456,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// --param ssp-buffer-size=
for (arg_iterator it = Args.filtered_begin(options::OPT__param),
ie = Args.filtered_end(); it != ie; ++it) {
StringRef Str((*it)->getValue(Args));
StringRef Str((*it)->getValue());
if (Str.startswith("ssp-buffer-size=")) {
if (StackProtectorLevel) {
CmdArgs.push_back("-stack-protector-buffer-size");
@ -2740,7 +2740,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// -fno-pack-struct doesn't apply to -fpack-struct=.
if (Arg *A = Args.getLastArg(options::OPT_fpack_struct_EQ)) {
std::string PackStructStr = "-fpack-struct=";
PackStructStr += A->getValue(Args);
PackStructStr += A->getValue();
CmdArgs.push_back(Args.MakeArgString(PackStructStr));
} else if (Args.hasFlag(options::OPT_fpack_struct,
options::OPT_fno_pack_struct, false)) {
@ -2789,13 +2789,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
if (const Arg *A =
Args.getLastArg(options::OPT_fdiagnostics_show_category_EQ)) {
CmdArgs.push_back("-fdiagnostics-show-category");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
if (const Arg *A =
Args.getLastArg(options::OPT_fdiagnostics_format_EQ)) {
CmdArgs.push_back("-fdiagnostics-format");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
if (Arg *A = Args.getLastArg(
@ -2887,7 +2887,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// Handle serialized diagnostics.
if (Arg *A = Args.getLastArg(options::OPT__serialize_diags)) {
CmdArgs.push_back("-serialize-diagnostic-file");
CmdArgs.push_back(Args.MakeArgString(A->getValue(Args)));
CmdArgs.push_back(Args.MakeArgString(A->getValue()));
}
if (Args.hasArg(options::OPT_fretain_comments_from_system_headers))
@ -2902,7 +2902,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// We translate this by hand to the -cc1 argument, since nightly test uses
// it and developers have been trained to spell it with -mllvm.
if (StringRef((*it)->getValue(Args, 0)) == "-disable-llvm-optzns")
if (StringRef((*it)->getValue(0)) == "-disable-llvm-optzns")
CmdArgs.push_back("-disable-llvm-optzns");
else
(*it)->render(Args, CmdArgs);
@ -3011,7 +3011,7 @@ ObjCRuntime Clang::AddObjCRuntimeArgs(const ArgList &args,
if (runtimeArg &&
runtimeArg->getOption().matches(options::OPT_fobjc_runtime_EQ)) {
ObjCRuntime runtime;
StringRef value = runtimeArg->getValue(args);
StringRef value = runtimeArg->getValue();
if (runtime.tryParse(value)) {
getToolChain().getDriver().Diag(diag::err_drv_unknown_objc_runtime)
<< value;
@ -3029,7 +3029,7 @@ ObjCRuntime Clang::AddObjCRuntimeArgs(const ArgList &args,
unsigned objcABIVersion = 1;
// If -fobjc-abi-version= is present, use that to set the version.
if (Arg *abiArg = args.getLastArg(options::OPT_fobjc_abi_version_EQ)) {
StringRef value = abiArg->getValue(args);
StringRef value = abiArg->getValue();
if (value == "1")
objcABIVersion = 1;
else if (value == "2")
@ -3057,7 +3057,7 @@ ObjCRuntime Clang::AddObjCRuntimeArgs(const ArgList &args,
if (Arg *abiArg = args.getLastArg(
options::OPT_fobjc_nonfragile_abi_version_EQ)) {
StringRef value = abiArg->getValue(args);
StringRef value = abiArg->getValue();
if (value == "1")
nonFragileABIVersion = 1;
else if (value == "2")
@ -3605,7 +3605,7 @@ darwin::CC1::getDependencyFileName(const ArgList &Args,
std::string Res;
if (Arg *OutputOpt = Args.getLastArg(options::OPT_o)) {
std::string Str(OutputOpt->getValue(Args));
std::string Str(OutputOpt->getValue());
Res = Str.substr(0, Str.rfind('.'));
} else {
Res = darwin::CC1::getBaseInputStem(Args, Inputs);
@ -3825,7 +3825,7 @@ void darwin::CC1::AddCC1OptionsArgs(const ArgList &Args, ArgStringList &CmdArgs,
Args.hasArg(options::OPT_o)) {
Arg *OutputOpt = Args.getLastArg(options::OPT_o);
CmdArgs.push_back("-auxbase-strip");
CmdArgs.push_back(OutputOpt->getValue(Args));
CmdArgs.push_back(OutputOpt->getValue());
} else {
CmdArgs.push_back("-auxbase");
CmdArgs.push_back(darwin::CC1::getBaseInputStem(Args, Inputs));
@ -3990,7 +3990,7 @@ void darwin::CC1::AddCPPUniqueOptionsArgs(const ArgList &Args,
(Args.hasArg(options::OPT_MD) || Args.hasArg(options::OPT_MMD))) {
if (Arg *OutputOpt = Args.getLastArg(options::OPT_o)) {
CmdArgs.push_back("-MQ");
CmdArgs.push_back(OutputOpt->getValue(Args));
CmdArgs.push_back(OutputOpt->getValue());
}
}
@ -4287,7 +4287,7 @@ void darwin::Link::AddLinkArgs(Compilation &C,
unsigned Version[3] = { 0, 0, 0 };
if (Arg *A = Args.getLastArg(options::OPT_mlinker_version_EQ)) {
bool HadExtra;
if (!Driver::GetReleaseVersion(A->getValue(Args), Version[0],
if (!Driver::GetReleaseVersion(A->getValue(), Version[0],
Version[1], Version[2], HadExtra) ||
HadExtra)
D.Diag(diag::err_drv_invalid_version_number)
@ -4308,7 +4308,7 @@ void darwin::Link::AddLinkArgs(Compilation &C,
ie = Args.filtered_end(); it != ie; ++it) {
const Arg *A = *it;
for (unsigned i = 0, e = A->getNumValues(); i != e; ++i)
if (StringRef(A->getValue(Args, i)) == "-kext")
if (StringRef(A->getValue(i)) == "-kext")
UsesLdClassic = true;
}
}
@ -4454,7 +4454,7 @@ void darwin::Link::AddLinkArgs(Compilation &C,
CmdArgs.push_back(C.getArgs().MakeArgString(sysroot));
} else if (const Arg *A = Args.getLastArg(options::OPT_isysroot)) {
CmdArgs.push_back("-syslibroot");
CmdArgs.push_back(A->getValue(Args));
CmdArgs.push_back(A->getValue());
}
Args.AddLastArg(CmdArgs, options::OPT_twolevel__namespace);
@ -5790,7 +5790,7 @@ static void AddLibgcc(llvm::Triple Triple, const Driver &D,
static bool hasMipsN32ABIArg(const ArgList &Args) {
Arg *A = Args.getLastArg(options::OPT_mabi_EQ);
return A && (A->getValue(Args) == StringRef("n32"));
return A && (A->getValue() == StringRef("n32"));
}
void linuxtools::Link::ConstructJob(Compilation &C, const JobAction &JA,

View File

@ -69,7 +69,7 @@ static unsigned getOptimizationLevel(ArgList &Args, InputKind IK,
assert (A->getOption().matches(options::OPT_O));
llvm::StringRef S(A->getValue(Args));
llvm::StringRef S(A->getValue());
if (S == "s" || S == "z" || S.empty())
return 2;
@ -83,7 +83,7 @@ static unsigned getOptimizationLevelSize(ArgList &Args, InputKind IK,
DiagnosticsEngine &Diags) {
if (Arg *A = Args.getLastArg(options::OPT_O_Group)) {
if (A->getOption().matches(options::OPT_O)) {
switch (A->getValue(Args)[0]) {
switch (A->getValue()[0]) {
default:
return 0;
case 's':
@ -107,7 +107,7 @@ static void addWarningArgs(ArgList &Args, std::vector<std::string> &Warnings) {
} else {
for (unsigned Idx = 0, End = A->getNumValues();
Idx < End; ++Idx) {
StringRef V = A->getValue(Args, Idx);
StringRef V = A->getValue(Idx);
// "-Wl," and such are not warning options.
// FIXME: Should be handled by putting these in separate flags.
if (V.startswith("l,") || V.startswith("a,") || V.startswith("p,"))
@ -124,7 +124,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
using namespace options;
bool Success = true;
if (Arg *A = Args.getLastArg(OPT_analyzer_store)) {
StringRef Name = A->getValue(Args);
StringRef Name = A->getValue();
AnalysisStores Value = llvm::StringSwitch<AnalysisStores>(Name)
#define ANALYSIS_STORE(NAME, CMDFLAG, DESC, CREATFN) \
.Case(CMDFLAG, NAME##Model)
@ -140,7 +140,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
}
if (Arg *A = Args.getLastArg(OPT_analyzer_constraints)) {
StringRef Name = A->getValue(Args);
StringRef Name = A->getValue();
AnalysisConstraints Value = llvm::StringSwitch<AnalysisConstraints>(Name)
#define ANALYSIS_CONSTRAINTS(NAME, CMDFLAG, DESC, CREATFN) \
.Case(CMDFLAG, NAME##Model)
@ -156,7 +156,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
}
if (Arg *A = Args.getLastArg(OPT_analyzer_output)) {
StringRef Name = A->getValue(Args);
StringRef Name = A->getValue();
AnalysisDiagClients Value = llvm::StringSwitch<AnalysisDiagClients>(Name)
#define ANALYSIS_DIAGNOSTICS(NAME, CMDFLAG, DESC, CREATFN, AUTOCREAT) \
.Case(CMDFLAG, PD_##NAME)
@ -172,7 +172,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
}
if (Arg *A = Args.getLastArg(OPT_analyzer_purge)) {
StringRef Name = A->getValue(Args);
StringRef Name = A->getValue();
AnalysisPurgeMode Value = llvm::StringSwitch<AnalysisPurgeMode>(Name)
#define ANALYSIS_PURGE(NAME, CMDFLAG, DESC) \
.Case(CMDFLAG, NAME)
@ -188,7 +188,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
}
if (Arg *A = Args.getLastArg(OPT_analyzer_ipa)) {
StringRef Name = A->getValue(Args);
StringRef Name = A->getValue();
AnalysisIPAMode Value = llvm::StringSwitch<AnalysisIPAMode>(Name)
#define ANALYSIS_IPA(NAME, CMDFLAG, DESC) \
.Case(CMDFLAG, NAME)
@ -204,7 +204,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
}
if (Arg *A = Args.getLastArg(OPT_analyzer_inlining_mode)) {
StringRef Name = A->getValue(Args);
StringRef Name = A->getValue();
AnalysisInliningMode Value = llvm::StringSwitch<AnalysisInliningMode>(Name)
#define ANALYSIS_INLINING_MODE(NAME, CMDFLAG, DESC) \
.Case(CMDFLAG, NAME)
@ -252,7 +252,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
bool enable = (A->getOption().getID() == OPT_analyzer_checker);
// We can have a list of comma separated checker names, e.g:
// '-analyzer-checker=cocoa,unix'
StringRef checkerList = A->getValue(Args);
StringRef checkerList = A->getValue();
SmallVector<StringRef, 4> checkers;
checkerList.split(checkers, ",");
for (unsigned i = 0, e = checkers.size(); i != e; ++i)
@ -266,7 +266,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
A->claim();
// We can have a list of comma separated config names, e.g:
// '-analyzer-config key1=val1,key2=val2'
StringRef configList = A->getValue(Args);
StringRef configList = A->getValue();
SmallVector<StringRef, 4> configVals;
configList.split(configVals, ",");
for (unsigned i = 0, e = configVals.size(); i != e; ++i) {
@ -406,14 +406,14 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
Args.getLastArgIntValue(OPT_stack_protector_buffer_size, 8, Diags);
Opts.StackRealignment = Args.hasArg(OPT_mstackrealign);
if (Arg *A = Args.getLastArg(OPT_mstack_alignment)) {
StringRef Val = A->getValue(Args);
StringRef Val = A->getValue();
unsigned StackAlignment = Opts.StackAlignment;
Val.getAsInteger(10, StackAlignment);
Opts.StackAlignment = StackAlignment;
}
if (Arg *A = Args.getLastArg(OPT_fobjc_dispatch_method_EQ)) {
StringRef Name = A->getValue(Args);
StringRef Name = A->getValue();
unsigned Method = llvm::StringSwitch<unsigned>(Name)
.Case("legacy", CodeGenOptions::Legacy)
.Case("non-legacy", CodeGenOptions::NonLegacy)
@ -429,7 +429,7 @@ static bool ParseCodeGenArgs(CodeGenOptions &Opts, ArgList &Args, InputKind IK,
}
if (Arg *A = Args.getLastArg(OPT_ftlsmodel_EQ)) {
StringRef Name = A->getValue(Args);
StringRef Name = A->getValue();
unsigned Model = llvm::StringSwitch<unsigned>(Name)
.Case("global-dynamic", CodeGenOptions::GeneralDynamicTLSModel)
.Case("local-dynamic", CodeGenOptions::LocalDynamicTLSModel)
@ -607,7 +607,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
case OPT_emit_obj:
Opts.ProgramAction = frontend::EmitObj; break;
case OPT_fixit_EQ:
Opts.FixItSuffix = A->getValue(Args);
Opts.FixItSuffix = A->getValue();
// fall-through!
case OPT_fixit:
Opts.ProgramAction = frontend::FixIt; break;
@ -643,14 +643,14 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
}
if (const Arg* A = Args.getLastArg(OPT_plugin)) {
Opts.Plugins.push_back(A->getValue(Args,0));
Opts.Plugins.push_back(A->getValue(0));
Opts.ProgramAction = frontend::PluginAction;
Opts.ActionName = A->getValue(Args);
Opts.ActionName = A->getValue();
for (arg_iterator it = Args.filtered_begin(OPT_plugin_arg),
end = Args.filtered_end(); it != end; ++it) {
if ((*it)->getValue(Args, 0) == Opts.ActionName)
Opts.PluginArgs.push_back((*it)->getValue(Args, 1));
if ((*it)->getValue(0) == Opts.ActionName)
Opts.PluginArgs.push_back((*it)->getValue(1));
}
}
@ -659,17 +659,17 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
for (int i = 0, e = Opts.AddPluginActions.size(); i != e; ++i) {
for (arg_iterator it = Args.filtered_begin(OPT_plugin_arg),
end = Args.filtered_end(); it != end; ++it) {
if ((*it)->getValue(Args, 0) == Opts.AddPluginActions[i])
Opts.AddPluginArgs[i].push_back((*it)->getValue(Args, 1));
if ((*it)->getValue(0) == Opts.AddPluginActions[i])
Opts.AddPluginArgs[i].push_back((*it)->getValue(1));
}
}
if (const Arg *A = Args.getLastArg(OPT_code_completion_at)) {
Opts.CodeCompletionAt =
ParsedSourceLocation::FromString(A->getValue(Args));
ParsedSourceLocation::FromString(A->getValue());
if (Opts.CodeCompletionAt.FileName.empty())
Diags.Report(diag::err_drv_invalid_value)
<< A->getAsString(Args) << A->getValue(Args);
<< A->getAsString(Args) << A->getValue();
}
Opts.DisableFree = Args.hasArg(OPT_disable_free);
@ -735,7 +735,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
InputKind DashX = IK_None;
if (const Arg *A = Args.getLastArg(OPT_x)) {
DashX = llvm::StringSwitch<InputKind>(A->getValue(Args))
DashX = llvm::StringSwitch<InputKind>(A->getValue())
.Case("c", IK_C)
.Case("cl", IK_OpenCL)
.Case("cuda", IK_CUDA)
@ -759,7 +759,7 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
.Default(IK_None);
if (DashX == IK_None)
Diags.Report(diag::err_drv_invalid_value)
<< A->getAsString(Args) << A->getValue(Args);
<< A->getAsString(Args) << A->getValue();
}
// '-' is the default input if none is given.
@ -807,7 +807,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
Opts.UseStandardSystemIncludes = !Args.hasArg(OPT_nostdsysteminc);
Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx);
if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ))
Opts.UseLibcxx = (strcmp(A->getValue(Args), "libc++") == 0);
Opts.UseLibcxx = (strcmp(A->getValue(), "libc++") == 0);
Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir);
Opts.ModuleCachePath = Args.getLastArgValue(OPT_fmodule_cache_path);
Opts.DisableModuleHash = Args.hasArg(OPT_fdisable_module_hash);
@ -826,7 +826,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
frontend::IncludeDirGroup Group
= IsIndexHeaderMap? frontend::IndexHeaderMap : frontend::Angled;
Opts.AddPath((*it)->getValue(Args), Group, true,
Opts.AddPath((*it)->getValue(), Group, true,
/*IsFramework=*/ (*it)->getOption().matches(OPT_F), false);
IsIndexHeaderMap = false;
}
@ -838,43 +838,43 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
ie = Args.filtered_end(); it != ie; ++it) {
const Arg *A = *it;
if (A->getOption().matches(OPT_iprefix))
Prefix = A->getValue(Args);
Prefix = A->getValue();
else if (A->getOption().matches(OPT_iwithprefix))
Opts.AddPath(Prefix.str() + A->getValue(Args),
Opts.AddPath(Prefix.str() + A->getValue(),
frontend::System, false, false, false);
else
Opts.AddPath(Prefix.str() + A->getValue(Args),
Opts.AddPath(Prefix.str() + A->getValue(),
frontend::Angled, false, false, false);
}
for (arg_iterator it = Args.filtered_begin(OPT_idirafter),
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::After, true, false, false);
Opts.AddPath((*it)->getValue(), frontend::After, true, false, false);
for (arg_iterator it = Args.filtered_begin(OPT_iquote),
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::Quoted, true, false, false);
Opts.AddPath((*it)->getValue(), frontend::Quoted, true, false, false);
for (arg_iterator it = Args.filtered_begin(OPT_isystem,
OPT_iwithsysroot), ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::System, true, false,
Opts.AddPath((*it)->getValue(), frontend::System, true, false,
!(*it)->getOption().matches(OPT_iwithsysroot));
for (arg_iterator it = Args.filtered_begin(OPT_iframework),
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::System, true, true,
Opts.AddPath((*it)->getValue(), frontend::System, true, true,
true);
// Add the paths for the various language specific isystem flags.
for (arg_iterator it = Args.filtered_begin(OPT_c_isystem),
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::CSystem, true, false, true);
Opts.AddPath((*it)->getValue(), frontend::CSystem, true, false, true);
for (arg_iterator it = Args.filtered_begin(OPT_cxx_isystem),
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::CXXSystem, true, false, true);
Opts.AddPath((*it)->getValue(), frontend::CXXSystem, true, false, true);
for (arg_iterator it = Args.filtered_begin(OPT_objc_isystem),
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::ObjCSystem, true, false,true);
Opts.AddPath((*it)->getValue(), frontend::ObjCSystem, true, false,true);
for (arg_iterator it = Args.filtered_begin(OPT_objcxx_isystem),
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::ObjCXXSystem, true, false,
Opts.AddPath((*it)->getValue(), frontend::ObjCXXSystem, true, false,
true);
// Add the internal paths from a driver that detects standard include paths.
@ -882,7 +882,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
OPT_internal_externc_isystem),
E = Args.filtered_end();
I != E; ++I)
Opts.AddPath((*I)->getValue(Args), frontend::System,
Opts.AddPath((*I)->getValue(), frontend::System,
false, false, /*IgnoreSysRoot=*/true, /*IsInternal=*/true,
(*I)->getOption().matches(OPT_internal_externc_isystem));
@ -891,7 +891,7 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
OPT_ino_system_prefix),
E = Args.filtered_end();
I != E; ++I)
Opts.AddSystemHeaderPrefix((*I)->getValue(Args),
Opts.AddSystemHeaderPrefix((*I)->getValue(),
(*I)->getOption().matches(OPT_isystem_prefix));
}
@ -997,14 +997,14 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
// FIXME: Cleanup per-file based stuff.
LangStandard::Kind LangStd = LangStandard::lang_unspecified;
if (const Arg *A = Args.getLastArg(OPT_std_EQ)) {
LangStd = llvm::StringSwitch<LangStandard::Kind>(A->getValue(Args))
LangStd = llvm::StringSwitch<LangStandard::Kind>(A->getValue())
#define LANGSTANDARD(id, name, desc, features) \
.Case(name, LangStandard::lang_##id)
#include "clang/Frontend/LangStandards.def"
.Default(LangStandard::lang_unspecified);
if (LangStd == LangStandard::lang_unspecified)
Diags.Report(diag::err_drv_invalid_value)
<< A->getAsString(Args) << A->getValue(Args);
<< A->getAsString(Args) << A->getValue();
else {
// Valid standard, check to make sure language and standard are compatable.
const LangStandard &Std = LangStandard::getLangStandardForKind(LangStd);
@ -1045,7 +1045,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
// Override the -std option in this case.
if (const Arg *A = Args.getLastArg(OPT_cl_std_EQ)) {
LangStandard::Kind OpenCLLangStd
= llvm::StringSwitch<LangStandard::Kind>(A->getValue(Args))
= llvm::StringSwitch<LangStandard::Kind>(A->getValue())
.Case("CL", LangStandard::lang_opencl)
.Case("CL1.1", LangStandard::lang_opencl11)
.Case("CL1.2", LangStandard::lang_opencl12)
@ -1053,7 +1053,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
if (OpenCLLangStd == LangStandard::lang_unspecified) {
Diags.Report(diag::err_drv_invalid_value)
<< A->getAsString(Args) << A->getValue(Args);
<< A->getAsString(Args) << A->getValue();
}
else
LangStd = OpenCLLangStd;
@ -1074,7 +1074,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
if (Opts.ObjC1) {
if (Arg *arg = Args.getLastArg(OPT_fobjc_runtime_EQ)) {
StringRef value = arg->getValue(Args);
StringRef value = arg->getValue();
if (Opts.ObjCRuntime.tryParse(value))
Diags.Report(diag::err_drv_unknown_objc_runtime) << value;
}
@ -1136,7 +1136,7 @@ static void ParseLangArgs(LangOptions &Opts, ArgList &Args, InputKind IK,
<< Args.getLastArg(OPT_fvisibility)->getAsString(Args) << Vis;
if (Arg *A = Args.getLastArg(OPT_ffp_contract)) {
StringRef Val = A->getValue(Args);
StringRef Val = A->getValue();
if (Val == "fast")
Opts.setFPContractMode(LangOptions::FPC_Fast);
else if (Val == "on")
@ -1280,7 +1280,7 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
Opts.ImplicitPCHInclude = Args.getLastArgValue(OPT_include_pch);
Opts.ImplicitPTHInclude = Args.getLastArgValue(OPT_include_pth);
if (const Arg *A = Args.getLastArg(OPT_token_cache))
Opts.TokenCache = A->getValue(Args);
Opts.TokenCache = A->getValue();
else
Opts.TokenCache = Opts.ImplicitPTHInclude;
Opts.UsePredefines = !Args.hasArg(OPT_undef);
@ -1291,11 +1291,11 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
for (arg_iterator it = Args.filtered_begin(OPT_error_on_deserialized_pch_decl),
ie = Args.filtered_end(); it != ie; ++it) {
const Arg *A = *it;
Opts.DeserializedPCHDeclsToErrorOn.insert(A->getValue(Args));
Opts.DeserializedPCHDeclsToErrorOn.insert(A->getValue());
}
if (const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) {
StringRef Value(A->getValue(Args));
StringRef Value(A->getValue());
size_t Comma = Value.find(',');
unsigned Bytes = 0;
unsigned EndOfLine = 0;
@ -1314,9 +1314,9 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
for (arg_iterator it = Args.filtered_begin(OPT_D, OPT_U),
ie = Args.filtered_end(); it != ie; ++it) {
if ((*it)->getOption().matches(OPT_D))
Opts.addMacroDef((*it)->getValue(Args));
Opts.addMacroDef((*it)->getValue());
else
Opts.addMacroUndef((*it)->getValue(Args));
Opts.addMacroUndef((*it)->getValue());
}
Opts.MacroIncludes = Args.getAllArgValues(OPT_imacros);
@ -1326,13 +1326,13 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
OPT_include_pth),
ie = Args.filtered_end(); it != ie; ++it) {
const Arg *A = *it;
Opts.Includes.push_back(A->getValue(Args));
Opts.Includes.push_back(A->getValue());
}
for (arg_iterator it = Args.filtered_begin(OPT_chain_include),
ie = Args.filtered_end(); it != ie; ++it) {
const Arg *A = *it;
Opts.ChainedIncludes.push_back(A->getValue(Args));
Opts.ChainedIncludes.push_back(A->getValue());
}
// Include 'altivec.h' if -faltivec option present
@ -1343,7 +1343,7 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
ie = Args.filtered_end(); it != ie; ++it) {
const Arg *A = *it;
std::pair<StringRef,StringRef> Split =
StringRef(A->getValue(Args)).split(';');
StringRef(A->getValue()).split(';');
if (Split.second.empty()) {
Diags.Report(diag::err_drv_invalid_remap_file) << A->getAsString(Args);
@ -1354,7 +1354,7 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
}
if (Arg *A = Args.getLastArg(OPT_fobjc_arc_cxxlib_EQ)) {
StringRef Name = A->getValue(Args);
StringRef Name = A->getValue();
unsigned Library = llvm::StringSwitch<unsigned>(Name)
.Case("libc++", ARCXX_libcxx)
.Case("libstdc++", ARCXX_libstdcxx)

View File

@ -189,7 +189,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
ie = Args->filtered_end(); it != ie; ++it, First=false) {
const Arg *A = it;
if (First)
Opts.InputFile = A->getValue(*Args);
Opts.InputFile = A->getValue();
else {
Diags.Report(diag::err_drv_unknown_argument) << A->getAsString(*Args);
Success = false;
@ -201,7 +201,7 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
Opts.LLVMArgs.push_back("-fatal-assembler-warnings");
Opts.OutputPath = Args->getLastArgValue(OPT_o);
if (Arg *A = Args->getLastArg(OPT_filetype)) {
StringRef Name = A->getValue(*Args);
StringRef Name = A->getValue();
unsigned OutputType = StringSwitch<unsigned>(Name)
.Case("asm", FT_Asm)
.Case("null", FT_Null)