forked from OSchip/llvm-project
range-for'ify Args->filtered_begin(...) loops
We already have Args->filtered(...) which is a drop-in range-for replacement. llvm-svn: 239381
This commit is contained in:
parent
e34147ce2f
commit
14facf307c
|
@ -140,10 +140,8 @@ InputArgList *Driver::ParseArgStrings(ArrayRef<const char *> ArgStrings) {
|
|||
}
|
||||
}
|
||||
|
||||
for (arg_iterator it = Args->filtered_begin(options::OPT_UNKNOWN),
|
||||
ie = Args->filtered_end(); it != ie; ++it) {
|
||||
Diags.Report(diag::err_drv_unknown_argument) << (*it) ->getAsString(*Args);
|
||||
}
|
||||
for (const Arg *A : Args->filtered(options::OPT_UNKNOWN))
|
||||
Diags.Report(diag::err_drv_unknown_argument) << A->getAsString(*Args);
|
||||
|
||||
return Args;
|
||||
}
|
||||
|
@ -347,9 +345,7 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
|
|||
DefaultTargetTriple = A->getValue();
|
||||
if (const Arg *A = Args->getLastArg(options::OPT_ccc_install_dir))
|
||||
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;
|
||||
for (const Arg *A : Args->filtered(options::OPT_B)) {
|
||||
A->claim();
|
||||
PrefixDirs.push_back(A->getValue(0));
|
||||
}
|
||||
|
@ -1467,9 +1463,8 @@ void Driver::BuildJobs(Compilation &C) const {
|
|||
if (Opt.getKind() == Option::FlagClass) {
|
||||
bool DuplicateClaimed = false;
|
||||
|
||||
for (arg_iterator it = C.getArgs().filtered_begin(&Opt),
|
||||
ie = C.getArgs().filtered_end(); it != ie; ++it) {
|
||||
if ((*it)->isClaimed()) {
|
||||
for (const Arg *AA : C.getArgs().filtered(&Opt)) {
|
||||
if (AA->isClaimed()) {
|
||||
DuplicateClaimed = true;
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -2174,14 +2174,9 @@ static void GetHexagonLibraryPaths(
|
|||
//----------------------------------------------------------------------------
|
||||
// -L Args
|
||||
//----------------------------------------------------------------------------
|
||||
for (arg_iterator
|
||||
it = Args.filtered_begin(options::OPT_L),
|
||||
ie = Args.filtered_end();
|
||||
it != ie;
|
||||
++it) {
|
||||
for (unsigned i = 0, e = (*it)->getNumValues(); i != e; ++i)
|
||||
LibPaths->push_back((*it)->getValue(i));
|
||||
}
|
||||
for (const Arg *A : Args.filtered(options::OPT_L))
|
||||
for (unsigned i = 0, e = A->getNumValues(); i != e; ++i)
|
||||
LibPaths->push_back(A->getValue(i));
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// Other standard paths
|
||||
|
|
|
@ -342,10 +342,7 @@ void Clang::AddPreprocessingOptions(Compilation &C,
|
|||
Args.AddLastArg(CmdArgs, options::OPT_MV);
|
||||
|
||||
// Convert all -MQ <target> args to -MT <quoted target>
|
||||
for (arg_iterator it = Args.filtered_begin(options::OPT_MT,
|
||||
options::OPT_MQ),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = *it;
|
||||
for (const Arg *A : Args.filtered(options::OPT_MT, options::OPT_MQ)) {
|
||||
A->claim();
|
||||
|
||||
if (A->getOption().matches(options::OPT_MQ)) {
|
||||
|
@ -366,10 +363,7 @@ void Clang::AddPreprocessingOptions(Compilation &C,
|
|||
// replacement into a build system already set up to be generating
|
||||
// .gch files.
|
||||
bool RenderedImplicitInclude = false;
|
||||
for (arg_iterator it = Args.filtered_begin(options::OPT_clang_i_Group),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = it;
|
||||
|
||||
for (const Arg *A : Args.filtered(options::OPT_clang_i_Group)) {
|
||||
if (A->getOption().matches(options::OPT_include)) {
|
||||
bool IsFirstImplicitInclude = !RenderedImplicitInclude;
|
||||
RenderedImplicitInclude = true;
|
||||
|
@ -1254,11 +1248,9 @@ static std::string getPPCTargetCPU(const ArgList &Args) {
|
|||
|
||||
static void getPPCTargetFeatures(const ArgList &Args,
|
||||
std::vector<const char *> &Features) {
|
||||
for (arg_iterator it = Args.filtered_begin(options::OPT_m_ppc_Features_Group),
|
||||
ie = Args.filtered_end();
|
||||
it != ie; ++it) {
|
||||
StringRef Name = (*it)->getOption().getName();
|
||||
(*it)->claim();
|
||||
for (const Arg *A : Args.filtered(options::OPT_m_ppc_Features_Group)) {
|
||||
StringRef Name = A->getOption().getName();
|
||||
A->claim();
|
||||
|
||||
// Skip over "-m".
|
||||
assert(Name.startswith("m") && "Invalid feature name.");
|
||||
|
@ -1619,11 +1611,9 @@ static void getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple,
|
|||
|
||||
// Now add any that the user explicitly requested on the command line,
|
||||
// which may override the defaults.
|
||||
for (arg_iterator it = Args.filtered_begin(options::OPT_m_x86_Features_Group),
|
||||
ie = Args.filtered_end();
|
||||
it != ie; ++it) {
|
||||
StringRef Name = (*it)->getOption().getName();
|
||||
(*it)->claim();
|
||||
for (const Arg *A : Args.filtered(options::OPT_m_x86_Features_Group)) {
|
||||
StringRef Name = A->getOption().getName();
|
||||
A->claim();
|
||||
|
||||
// Skip over "-m".
|
||||
assert(Name.startswith("m") && "Invalid feature name.");
|
||||
|
@ -2086,10 +2076,8 @@ static void CollectArgsForIntegratedAssembler(Compilation &C,
|
|||
// When using an integrated assembler, translate -Wa, and -Xassembler
|
||||
// options.
|
||||
bool CompressDebugSections = false;
|
||||
for (arg_iterator it = Args.filtered_begin(options::OPT_Wa_COMMA,
|
||||
options::OPT_Xassembler),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = *it;
|
||||
for (const Arg *A :
|
||||
Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) {
|
||||
A->claim();
|
||||
|
||||
for (unsigned i = 0, e = A->getNumValues(); i != e; ++i) {
|
||||
|
@ -2970,14 +2958,11 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
if (Args.hasArg(options::OPT_frewrite_map_file) ||
|
||||
Args.hasArg(options::OPT_frewrite_map_file_EQ)) {
|
||||
for (arg_iterator
|
||||
MFI = Args.filtered_begin(options::OPT_frewrite_map_file,
|
||||
options::OPT_frewrite_map_file_EQ),
|
||||
MFE = Args.filtered_end();
|
||||
MFI != MFE; ++MFI) {
|
||||
for (const Arg *A : Args.filtered(options::OPT_frewrite_map_file,
|
||||
options::OPT_frewrite_map_file_EQ)) {
|
||||
CmdArgs.push_back("-frewrite-map-file");
|
||||
CmdArgs.push_back((*MFI)->getValue());
|
||||
(*MFI)->claim();
|
||||
CmdArgs.push_back(A->getValue());
|
||||
A->claim();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3605,10 +3590,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
}
|
||||
|
||||
// Warn about ignored options to clang.
|
||||
for (arg_iterator it = Args.filtered_begin(
|
||||
options::OPT_clang_ignored_gcc_optimization_f_Group),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
D.Diag(diag::warn_ignored_gcc_optimization) << (*it)->getAsString(Args);
|
||||
for (const Arg *A :
|
||||
Args.filtered(options::OPT_clang_ignored_gcc_optimization_f_Group)) {
|
||||
D.Diag(diag::warn_ignored_gcc_optimization) << A->getAsString(Args);
|
||||
}
|
||||
|
||||
claimNoWarnArgs(Args);
|
||||
|
@ -3929,16 +3913,15 @@ 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());
|
||||
for (const Arg *A : Args.filtered(options::OPT__param)) {
|
||||
StringRef Str(A->getValue());
|
||||
if (Str.startswith("ssp-buffer-size=")) {
|
||||
if (StackProtectorLevel) {
|
||||
CmdArgs.push_back("-stack-protector-buffer-size");
|
||||
// FIXME: Verify the argument is a valid integer.
|
||||
CmdArgs.push_back(Args.MakeArgString(Str.drop_front(16)));
|
||||
}
|
||||
(*it)->claim();
|
||||
A->claim();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4678,17 +4661,16 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
// parser.
|
||||
Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
|
||||
bool OptDisabled = false;
|
||||
for (arg_iterator it = Args.filtered_begin(options::OPT_mllvm),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
(*it)->claim();
|
||||
for (const Arg *A : Args.filtered(options::OPT_mllvm)) {
|
||||
A->claim();
|
||||
|
||||
// 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(0)) == "-disable-llvm-optzns") {
|
||||
if (StringRef(A->getValue(0)) == "-disable-llvm-optzns") {
|
||||
CmdArgs.push_back("-disable-llvm-optzns");
|
||||
OptDisabled = true;
|
||||
} else
|
||||
(*it)->render(Args, CmdArgs);
|
||||
A->render(Args, CmdArgs);
|
||||
}
|
||||
|
||||
// With -save-temps, we want to save the unoptimized bitcode output from the
|
||||
|
@ -5219,10 +5201,8 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
// doesn't handle that so rather than warning about unused flags that are
|
||||
// actually used, we'll lie by omission instead.
|
||||
// FIXME: Stop lying and consume only the appropriate driver flags
|
||||
for (arg_iterator it = Args.filtered_begin(options::OPT_W_Group),
|
||||
ie = Args.filtered_end();
|
||||
it != ie; ++it)
|
||||
(*it)->claim();
|
||||
for (const Arg *A : Args.filtered(options::OPT_W_Group))
|
||||
A->claim();
|
||||
|
||||
CollectArgsForIntegratedAssembler(C, Args, CmdArgs,
|
||||
getToolChain().getDriver());
|
||||
|
@ -5553,10 +5533,9 @@ static void constructHexagonLinkArgs(Compilation &C, const JobAction &JA,
|
|||
std::vector<std::string> oslibs;
|
||||
bool hasStandalone= false;
|
||||
|
||||
for (arg_iterator it = Args.filtered_begin(options::OPT_moslib_EQ),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
(*it)->claim();
|
||||
oslibs.emplace_back((*it)->getValue());
|
||||
for (const Arg *A : Args.filtered(options::OPT_moslib_EQ)) {
|
||||
A->claim();
|
||||
oslibs.emplace_back(A->getValue());
|
||||
hasStandalone = hasStandalone || (oslibs.back() == "standalone");
|
||||
}
|
||||
if (oslibs.empty()) {
|
||||
|
@ -6359,10 +6338,8 @@ void darwin::Link::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
Args.AddAllArgs(CmdArgs, options::OPT_F);
|
||||
|
||||
// -iframework should be forwarded as -F.
|
||||
for (auto it = Args.filtered_begin(options::OPT_iframework),
|
||||
ie = Args.filtered_end(); it != ie; ++it)
|
||||
CmdArgs.push_back(Args.MakeArgString(std::string("-F") +
|
||||
(*it)->getValue()));
|
||||
for (const Arg *A : Args.filtered(options::OPT_iframework))
|
||||
CmdArgs.push_back(Args.MakeArgString(std::string("-F") + A->getValue()));
|
||||
|
||||
if (!Args.hasArg(options::OPT_nostdlib) &&
|
||||
!Args.hasArg(options::OPT_nodefaultlibs)) {
|
||||
|
|
|
@ -239,10 +239,8 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
|
|||
Opts.InlineMaxStackDepth, Diags);
|
||||
|
||||
Opts.CheckersControlList.clear();
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_analyzer_checker,
|
||||
OPT_analyzer_disable_checker),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = *it;
|
||||
for (const Arg *A :
|
||||
Args.filtered(OPT_analyzer_checker, OPT_analyzer_disable_checker)) {
|
||||
A->claim();
|
||||
bool enable = (A->getOption().getID() == OPT_analyzer_checker);
|
||||
// We can have a list of comma separated checker names, e.g:
|
||||
|
@ -255,9 +253,7 @@ static bool ParseAnalyzerArgs(AnalyzerOptions &Opts, ArgList &Args,
|
|||
}
|
||||
|
||||
// Go through the analyzer configuration options.
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_analyzer_config),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = *it;
|
||||
for (const Arg *A : Args.filtered(OPT_analyzer_config)) {
|
||||
A->claim();
|
||||
// We can have a list of comma separated config names, e.g:
|
||||
// '-analyzer-config key1=val1,key2=val2'
|
||||
|
@ -871,22 +867,17 @@ static InputKind ParseFrontendArgs(FrontendOptions &Opts, ArgList &Args,
|
|||
Opts.ProgramAction = frontend::PluginAction;
|
||||
Opts.ActionName = A->getValue();
|
||||
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_plugin_arg),
|
||||
end = Args.filtered_end(); it != end; ++it) {
|
||||
if ((*it)->getValue(0) == Opts.ActionName)
|
||||
Opts.PluginArgs.emplace_back((*it)->getValue(1));
|
||||
}
|
||||
for (const Arg *AA : Args.filtered(OPT_plugin_arg))
|
||||
if (AA->getValue(0) == Opts.ActionName)
|
||||
Opts.PluginArgs.emplace_back(AA->getValue(1));
|
||||
}
|
||||
|
||||
Opts.AddPluginActions = Args.getAllArgValues(OPT_add_plugin);
|
||||
Opts.AddPluginArgs.resize(Opts.AddPluginActions.size());
|
||||
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(0) == Opts.AddPluginActions[i])
|
||||
Opts.AddPluginArgs[i].emplace_back((*it)->getValue(1));
|
||||
}
|
||||
}
|
||||
for (int i = 0, e = Opts.AddPluginActions.size(); i != e; ++i)
|
||||
for (const Arg *A : Args.filtered(OPT_plugin_arg))
|
||||
if (A->getValue(0) == Opts.AddPluginActions[i])
|
||||
Opts.AddPluginArgs[i].emplace_back(A->getValue(1));
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_code_completion_at)) {
|
||||
Opts.CodeCompletionAt =
|
||||
|
@ -1088,98 +1079,77 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
|
|||
Opts.ModulesValidateSystemHeaders =
|
||||
Args.hasArg(OPT_fmodules_validate_system_headers);
|
||||
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_fmodules_ignore_macro),
|
||||
ie = Args.filtered_end();
|
||||
it != ie; ++it) {
|
||||
StringRef MacroDef = (*it)->getValue();
|
||||
for (const Arg *A : Args.filtered(OPT_fmodules_ignore_macro)) {
|
||||
StringRef MacroDef = A->getValue();
|
||||
Opts.ModulesIgnoreMacros.insert(MacroDef.split('=').first);
|
||||
}
|
||||
|
||||
// Add -I..., -F..., and -index-header-map options in order.
|
||||
bool IsIndexHeaderMap = false;
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_I, OPT_F,
|
||||
OPT_index_header_map),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
if ((*it)->getOption().matches(OPT_index_header_map)) {
|
||||
for (const Arg *A : Args.filtered(OPT_I, OPT_F, OPT_index_header_map)) {
|
||||
if (A->getOption().matches(OPT_index_header_map)) {
|
||||
// -index-header-map applies to the next -I or -F.
|
||||
IsIndexHeaderMap = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
frontend::IncludeDirGroup Group
|
||||
= IsIndexHeaderMap? frontend::IndexHeaderMap : frontend::Angled;
|
||||
|
||||
Opts.AddPath((*it)->getValue(), Group,
|
||||
/*IsFramework=*/ (*it)->getOption().matches(OPT_F), true);
|
||||
|
||||
frontend::IncludeDirGroup Group =
|
||||
IsIndexHeaderMap ? frontend::IndexHeaderMap : frontend::Angled;
|
||||
|
||||
Opts.AddPath(A->getValue(), Group,
|
||||
/*IsFramework=*/A->getOption().matches(OPT_F), true);
|
||||
IsIndexHeaderMap = false;
|
||||
}
|
||||
|
||||
// Add -iprefix/-iwithprefix/-iwithprefixbefore options.
|
||||
StringRef Prefix = ""; // FIXME: This isn't the correct default prefix.
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_iprefix, OPT_iwithprefix,
|
||||
OPT_iwithprefixbefore),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = *it;
|
||||
for (const Arg *A :
|
||||
Args.filtered(OPT_iprefix, OPT_iwithprefix, OPT_iwithprefixbefore)) {
|
||||
if (A->getOption().matches(OPT_iprefix))
|
||||
Prefix = A->getValue();
|
||||
else if (A->getOption().matches(OPT_iwithprefix))
|
||||
Opts.AddPath(Prefix.str() + A->getValue(),
|
||||
frontend::After, false, true);
|
||||
Opts.AddPath(Prefix.str() + A->getValue(), frontend::After, false, true);
|
||||
else
|
||||
Opts.AddPath(Prefix.str() + A->getValue(),
|
||||
frontend::Angled, false, true);
|
||||
Opts.AddPath(Prefix.str() + A->getValue(), frontend::Angled, false, true);
|
||||
}
|
||||
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_idirafter),
|
||||
ie = Args.filtered_end(); it != ie; ++it)
|
||||
Opts.AddPath((*it)->getValue(), frontend::After, false, true);
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_iquote),
|
||||
ie = Args.filtered_end(); it != ie; ++it)
|
||||
Opts.AddPath((*it)->getValue(), frontend::Quoted, false, true);
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_isystem,
|
||||
OPT_iwithsysroot), ie = Args.filtered_end(); it != ie; ++it)
|
||||
Opts.AddPath((*it)->getValue(), frontend::System, 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(), frontend::System, true, true);
|
||||
for (const Arg *A : Args.filtered(OPT_idirafter))
|
||||
Opts.AddPath(A->getValue(), frontend::After, false, true);
|
||||
for (const Arg *A : Args.filtered(OPT_iquote))
|
||||
Opts.AddPath(A->getValue(), frontend::Quoted, false, true);
|
||||
for (const Arg *A : Args.filtered(OPT_isystem, OPT_iwithsysroot))
|
||||
Opts.AddPath(A->getValue(), frontend::System, false,
|
||||
!A->getOption().matches(OPT_iwithsysroot));
|
||||
for (const Arg *A : Args.filtered(OPT_iframework))
|
||||
Opts.AddPath(A->getValue(), frontend::System, 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(), frontend::CSystem, false, true);
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_cxx_isystem),
|
||||
ie = Args.filtered_end(); it != ie; ++it)
|
||||
Opts.AddPath((*it)->getValue(), frontend::CXXSystem, false, true);
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_objc_isystem),
|
||||
ie = Args.filtered_end(); it != ie; ++it)
|
||||
Opts.AddPath((*it)->getValue(), frontend::ObjCSystem, false,true);
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_objcxx_isystem),
|
||||
ie = Args.filtered_end(); it != ie; ++it)
|
||||
Opts.AddPath((*it)->getValue(), frontend::ObjCXXSystem, false, true);
|
||||
for (const Arg *A : Args.filtered(OPT_c_isystem))
|
||||
Opts.AddPath(A->getValue(), frontend::CSystem, false, true);
|
||||
for (const Arg *A : Args.filtered(OPT_cxx_isystem))
|
||||
Opts.AddPath(A->getValue(), frontend::CXXSystem, false, true);
|
||||
for (const Arg *A : Args.filtered(OPT_objc_isystem))
|
||||
Opts.AddPath(A->getValue(), frontend::ObjCSystem, false,true);
|
||||
for (const Arg *A : Args.filtered(OPT_objcxx_isystem))
|
||||
Opts.AddPath(A->getValue(), frontend::ObjCXXSystem, false, true);
|
||||
|
||||
// Add the internal paths from a driver that detects standard include paths.
|
||||
for (arg_iterator I = Args.filtered_begin(OPT_internal_isystem,
|
||||
OPT_internal_externc_isystem),
|
||||
E = Args.filtered_end();
|
||||
I != E; ++I) {
|
||||
for (const Arg *A :
|
||||
Args.filtered(OPT_internal_isystem, OPT_internal_externc_isystem)) {
|
||||
frontend::IncludeDirGroup Group = frontend::System;
|
||||
if ((*I)->getOption().matches(OPT_internal_externc_isystem))
|
||||
if (A->getOption().matches(OPT_internal_externc_isystem))
|
||||
Group = frontend::ExternCSystem;
|
||||
Opts.AddPath((*I)->getValue(), Group, false, true);
|
||||
Opts.AddPath(A->getValue(), Group, false, true);
|
||||
}
|
||||
|
||||
// Add the path prefixes which are implicitly treated as being system headers.
|
||||
for (arg_iterator I = Args.filtered_begin(OPT_system_header_prefix,
|
||||
OPT_no_system_header_prefix),
|
||||
E = Args.filtered_end();
|
||||
I != E; ++I)
|
||||
for (const Arg *A :
|
||||
Args.filtered(OPT_system_header_prefix, OPT_no_system_header_prefix))
|
||||
Opts.AddSystemHeaderPrefix(
|
||||
(*I)->getValue(), (*I)->getOption().matches(OPT_system_header_prefix));
|
||||
A->getValue(), A->getOption().matches(OPT_system_header_prefix));
|
||||
|
||||
for (arg_iterator I = Args.filtered_begin(OPT_ivfsoverlay),
|
||||
E = Args.filtered_end(); I != E; ++I)
|
||||
Opts.AddVFSOverlayFile((*I)->getValue());
|
||||
for (const Arg *A : Args.filtered(OPT_ivfsoverlay))
|
||||
Opts.AddVFSOverlayFile(A->getValue());
|
||||
}
|
||||
|
||||
void CompilerInvocation::setLangDefaults(LangOptions &Opts, InputKind IK,
|
||||
|
@ -1708,11 +1678,8 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
|
|||
Opts.DisablePCHValidation = Args.hasArg(OPT_fno_validate_pch);
|
||||
|
||||
Opts.DumpDeserializedPCHDecls = Args.hasArg(OPT_dump_deserialized_pch_decls);
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_error_on_deserialized_pch_decl),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = *it;
|
||||
for (const Arg *A : Args.filtered(OPT_error_on_deserialized_pch_decl))
|
||||
Opts.DeserializedPCHDeclsToErrorOn.insert(A->getValue());
|
||||
}
|
||||
|
||||
if (const Arg *A = Args.getLastArg(OPT_preamble_bytes_EQ)) {
|
||||
StringRef Value(A->getValue());
|
||||
|
@ -1731,38 +1698,28 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
|
|||
}
|
||||
|
||||
// Add macros from the command line.
|
||||
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());
|
||||
for (const Arg *A : Args.filtered(OPT_D, OPT_U)) {
|
||||
if (A->getOption().matches(OPT_D))
|
||||
Opts.addMacroDef(A->getValue());
|
||||
else
|
||||
Opts.addMacroUndef((*it)->getValue());
|
||||
Opts.addMacroUndef(A->getValue());
|
||||
}
|
||||
|
||||
Opts.MacroIncludes = Args.getAllArgValues(OPT_imacros);
|
||||
|
||||
// Add the ordered list of -includes.
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_include),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = *it;
|
||||
for (const Arg *A : Args.filtered(OPT_include))
|
||||
Opts.Includes.emplace_back(A->getValue());
|
||||
}
|
||||
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_chain_include),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = *it;
|
||||
for (const Arg *A : Args.filtered(OPT_chain_include))
|
||||
Opts.ChainedIncludes.emplace_back(A->getValue());
|
||||
}
|
||||
|
||||
// Include 'altivec.h' if -faltivec option present
|
||||
if (Args.hasArg(OPT_faltivec))
|
||||
Opts.Includes.emplace_back("altivec.h");
|
||||
|
||||
for (arg_iterator it = Args.filtered_begin(OPT_remap_file),
|
||||
ie = Args.filtered_end(); it != ie; ++it) {
|
||||
const Arg *A = *it;
|
||||
std::pair<StringRef,StringRef> Split =
|
||||
StringRef(A->getValue()).split(';');
|
||||
for (const Arg *A : Args.filtered(OPT_remap_file)) {
|
||||
std::pair<StringRef, StringRef> Split = StringRef(A->getValue()).split(';');
|
||||
|
||||
if (Split.second.empty()) {
|
||||
Diags.Report(diag::err_drv_invalid_remap_file) << A->getAsString(Args);
|
||||
|
@ -1771,7 +1728,7 @@ static void ParsePreprocessorArgs(PreprocessorOptions &Opts, ArgList &Args,
|
|||
|
||||
Opts.addRemappedFile(Split.first, Split.second);
|
||||
}
|
||||
|
||||
|
||||
if (Arg *A = Args.getLastArg(OPT_fobjc_arc_cxxlib_EQ)) {
|
||||
StringRef Name = A->getValue();
|
||||
unsigned Library = llvm::StringSwitch<unsigned>(Name)
|
||||
|
@ -1874,9 +1831,8 @@ bool CompilerInvocation::CreateFromArgs(CompilerInvocation &Res,
|
|||
}
|
||||
|
||||
// Issue errors on unknown arguments.
|
||||
for (arg_iterator it = Args->filtered_begin(OPT_UNKNOWN),
|
||||
ie = Args->filtered_end(); it != ie; ++it) {
|
||||
Diags.Report(diag::err_drv_unknown_argument) << (*it)->getAsString(*Args);
|
||||
for (const Arg *A : Args->filtered(OPT_UNKNOWN)) {
|
||||
Diags.Report(diag::err_drv_unknown_argument) << A->getAsString(*Args);
|
||||
Success = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -173,10 +173,8 @@ bool AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts,
|
|||
}
|
||||
|
||||
// Issue errors on unknown arguments.
|
||||
for (arg_iterator it = Args->filtered_begin(OPT_UNKNOWN),
|
||||
ie = Args->filtered_end();
|
||||
it != ie; ++it) {
|
||||
Diags.Report(diag::err_drv_unknown_argument) << (*it)->getAsString(*Args);
|
||||
for (const Arg *A : Args->filtered(OPT_UNKNOWN)) {
|
||||
Diags.Report(diag::err_drv_unknown_argument) << A->getAsString(*Args);
|
||||
Success = false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue