diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2018-03-20 21:08:59 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2018-03-20 21:08:59 +0000 |
commit | 5e4511cfc7e04c4bff78af66843f1625832a03d5 (patch) | |
tree | e48dbf9066f3b2a012282330995d2d7bf0a2b832 /clang/lib/Driver | |
parent | 0f110a88bef3b2e46c029c21d9352a120cd995dd (diff) | |
download | bcm5719-llvm-5e4511cfc7e04c4bff78af66843f1625832a03d5.tar.gz bcm5719-llvm-5e4511cfc7e04c4bff78af66843f1625832a03d5.zip |
[Driver] Fix some Clang-tidy modernize and Include What You Use warnings; other minor fixes (NFC).
llvm-svn: 328044
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r-- | clang/lib/Driver/Action.cpp | 38 | ||||
-rw-r--r-- | clang/lib/Driver/Compilation.cpp | 46 | ||||
-rw-r--r-- | clang/lib/Driver/Job.cpp | 39 | ||||
-rw-r--r-- | clang/lib/Driver/Multilib.cpp | 31 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChain.cpp | 50 |
5 files changed, 110 insertions, 94 deletions
diff --git a/clang/lib/Driver/Action.cpp b/clang/lib/Driver/Action.cpp index 85e466a4409..3e65f9e05fb 100644 --- a/clang/lib/Driver/Action.cpp +++ b/clang/lib/Driver/Action.cpp @@ -1,4 +1,4 @@ -//===--- Action.cpp - Abstract compilation steps --------------------------===// +//===- Action.cpp - Abstract compilation steps ----------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,16 +8,15 @@ //===----------------------------------------------------------------------===// #include "clang/Driver/Action.h" -#include "clang/Driver/ToolChain.h" -#include "llvm/ADT/StringRef.h" -#include "llvm/ADT/StringSwitch.h" #include "llvm/Support/ErrorHandling.h" -#include "llvm/Support/Regex.h" #include <cassert> -using namespace clang::driver; +#include <string> + +using namespace clang; +using namespace driver; using namespace llvm::opt; -Action::~Action() {} +Action::~Action() = default; const char *Action::getClassName(ActionClass AC) { switch (AC) { @@ -102,7 +101,7 @@ std::string Action::getOffloadingKindPrefix() const { } if (!ActiveOffloadKindMask) - return ""; + return {}; std::string Res("host"); if (ActiveOffloadKindMask & OFK_Cuda) @@ -119,11 +118,11 @@ std::string Action::getOffloadingKindPrefix() const { /// for each offloading kind. std::string Action::GetOffloadingFileNamePrefix(OffloadKind Kind, - llvm::StringRef NormalizedTriple, + StringRef NormalizedTriple, bool CreatePrefixForHost) { // Don't generate prefix for host actions unless required. if (!CreatePrefixForHost && (Kind == OFK_None || Kind == OFK_Host)) - return ""; + return {}; std::string Res("-"); Res += GetOffloadKindName(Kind); @@ -134,7 +133,7 @@ Action::GetOffloadingFileNamePrefix(OffloadKind Kind, /// Return a string with the offload kind name. If that is not defined, we /// assume 'host'. -llvm::StringRef Action::GetOffloadKindName(OffloadKind Kind) { +StringRef Action::GetOffloadKindName(OffloadKind Kind) { switch (Kind) { case OFK_None: case OFK_Host: @@ -153,12 +152,11 @@ llvm::StringRef Action::GetOffloadKindName(OffloadKind Kind) { void InputAction::anchor() {} InputAction::InputAction(const Arg &_Input, types::ID _Type) - : Action(InputClass, _Type), Input(_Input) { -} + : Action(InputClass, _Type), Input(_Input) {} void BindArchAction::anchor() {} -BindArchAction::BindArchAction(Action *Input, llvm::StringRef ArchName) +BindArchAction::BindArchAction(Action *Input, StringRef ArchName) : Action(BindArchClass, Input), ArchName(ArchName) {} void OffloadAction::anchor() {} @@ -300,8 +298,7 @@ JobAction::JobAction(ActionClass Kind, Action *Input, types::ID Type) : Action(Kind, Input, Type) {} JobAction::JobAction(ActionClass Kind, const ActionList &Inputs, types::ID Type) - : Action(Kind, Inputs, Type) { -} + : Action(Kind, Inputs, Type) {} void PreprocessJobAction::anchor() {} @@ -341,20 +338,17 @@ AssembleJobAction::AssembleJobAction(Action *Input, types::ID OutputType) void LinkJobAction::anchor() {} LinkJobAction::LinkJobAction(ActionList &Inputs, types::ID Type) - : JobAction(LinkJobClass, Inputs, Type) { -} + : JobAction(LinkJobClass, Inputs, Type) {} void LipoJobAction::anchor() {} LipoJobAction::LipoJobAction(ActionList &Inputs, types::ID Type) - : JobAction(LipoJobClass, Inputs, Type) { -} + : JobAction(LipoJobClass, Inputs, Type) {} void DsymutilJobAction::anchor() {} DsymutilJobAction::DsymutilJobAction(ActionList &Inputs, types::ID Type) - : JobAction(DsymutilJobClass, Inputs, Type) { -} + : JobAction(DsymutilJobClass, Inputs, Type) {} void VerifyJobAction::anchor() {} diff --git a/clang/lib/Driver/Compilation.cpp b/clang/lib/Driver/Compilation.cpp index 645da505958..5944936a0ad 100644 --- a/clang/lib/Driver/Compilation.cpp +++ b/clang/lib/Driver/Compilation.cpp @@ -1,4 +1,4 @@ -//===--- Compilation.cpp - Compilation Task Implementation ----------------===// +//===- Compilation.cpp - Compilation Task Implementation ------------------===// // // The LLVM Compiler Infrastructure // @@ -8,26 +8,37 @@ //===----------------------------------------------------------------------===// #include "clang/Driver/Compilation.h" +#include "clang/Basic/LLVM.h" #include "clang/Driver/Action.h" #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" +#include "clang/Driver/Job.h" #include "clang/Driver/Options.h" #include "clang/Driver/ToolChain.h" +#include "clang/Driver/Util.h" +#include "llvm/ADT/None.h" #include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/Triple.h" #include "llvm/Option/ArgList.h" +#include "llvm/Option/OptSpecifier.h" +#include "llvm/Option/Option.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/raw_ostream.h" +#include <cassert> +#include <string> +#include <system_error> +#include <utility> -using namespace clang::driver; using namespace clang; +using namespace driver; using namespace llvm::opt; Compilation::Compilation(const Driver &D, const ToolChain &_DefaultToolChain, InputArgList *_Args, DerivedArgList *_TranslatedArgs, bool ContainsError) - : TheDriver(D), DefaultToolChain(_DefaultToolChain), ActiveOffloadMask(0u), - Args(_Args), TranslatedArgs(_TranslatedArgs), ForDiagnostics(false), - ContainsError(ContainsError) { + : TheDriver(D), DefaultToolChain(_DefaultToolChain), Args(_Args), + TranslatedArgs(_TranslatedArgs), ContainsError(ContainsError) { // The offloading host toolchain is the default toolchain. OrderedOffloadingToolchains.insert( std::make_pair(Action::OFK_Host, &DefaultToolChain)); @@ -74,9 +85,8 @@ Compilation::getArgsForToolChain(const ToolChain *TC, StringRef BoundArch, } // Add allocated arguments to the final DAL. - for (auto ArgPtr : AllocatedArgs) { + for (auto ArgPtr : AllocatedArgs) Entry->AddSynthesizedArg(ArgPtr); - } } return *Entry; @@ -105,7 +115,7 @@ bool Compilation::CleanupFile(const char *File, bool IssueErrors) const { // so we don't need to check again. if (IssueErrors) - getDriver().Diag(clang::diag::err_drv_unable_to_remove_file) + getDriver().Diag(diag::err_drv_unable_to_remove_file) << EC.message(); return false; } @@ -115,9 +125,8 @@ bool Compilation::CleanupFile(const char *File, bool IssueErrors) const { bool Compilation::CleanupFileList(const ArgStringList &Files, bool IssueErrors) const { bool Success = true; - for (ArgStringList::const_iterator - it = Files.begin(), ie = Files.end(); it != ie; ++it) - Success &= CleanupFile(*it, IssueErrors); + for (const auto &File: Files) + Success &= CleanupFile(File, IssueErrors); return Success; } @@ -125,14 +134,12 @@ bool Compilation::CleanupFileMap(const ArgStringMap &Files, const JobAction *JA, bool IssueErrors) const { bool Success = true; - for (ArgStringMap::const_iterator - it = Files.begin(), ie = Files.end(); it != ie; ++it) { - + for (const auto &File : Files) { // If specified, only delete the files associated with the JobAction. // Otherwise, delete all files in the map. - if (JA && it->first != JA) + if (JA && File.first != JA) continue; - Success &= CleanupFile(it->second, IssueErrors); + Success &= CleanupFile(File.second, IssueErrors); } return Success; } @@ -151,7 +158,7 @@ int Compilation::ExecuteCommand(const Command &C, llvm::sys::fs::F_Append | llvm::sys::fs::F_Text); if (EC) { - getDriver().Diag(clang::diag::err_drv_cc_print_options_failure) + getDriver().Diag(diag::err_drv_cc_print_options_failure) << EC.message(); FailingCommand = &C; delete OS; @@ -173,7 +180,7 @@ int Compilation::ExecuteCommand(const Command &C, int Res = C.Execute(Redirects, &Error, &ExecutionFailed); if (!Error.empty()) { assert(Res && "Error string set with 0 result code!"); - getDriver().Diag(clang::diag::err_drv_command_failure) << Error; + getDriver().Diag(diag::err_drv_command_failure) << Error; } if (Res) @@ -186,7 +193,6 @@ using FailingCommandList = SmallVectorImpl<std::pair<int, const Command *>>; static bool ActionFailed(const Action *A, const FailingCommandList &FailingCommands) { - if (FailingCommands.empty()) return false; @@ -200,7 +206,7 @@ static bool ActionFailed(const Action *A, if (A == &(CI.second->getSource())) return true; - for (const Action *AI : A->inputs()) + for (const auto *AI : A->inputs()) if (ActionFailed(AI, FailingCommands)) return true; diff --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp index 765c05752d8..df08ba3e73f 100644 --- a/clang/lib/Driver/Job.cpp +++ b/clang/lib/Driver/Job.cpp @@ -1,4 +1,4 @@ -//===--- Job.cpp - Command to Execute -------------------------------------===// +//===- Job.cpp - Command to Execute ---------------------------------------===// // // The LLVM Compiler Infrastructure // @@ -9,14 +9,14 @@ #include "clang/Driver/Job.h" #include "InputInfo.h" +#include "clang/Basic/LLVM.h" #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" #include "clang/Driver/Tool.h" #include "clang/Driver/ToolChain.h" #include "llvm/ADT/ArrayRef.h" -#include "llvm/ADT/Optional.h" -#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" #include "llvm/ADT/StringSwitch.h" @@ -24,17 +24,21 @@ #include "llvm/Support/Path.h" #include "llvm/Support/Program.h" #include "llvm/Support/raw_ostream.h" +#include <algorithm> #include <cassert> -using namespace clang::driver; -using llvm::raw_ostream; -using llvm::StringRef; -using llvm::ArrayRef; +#include <cstddef> +#include <string> +#include <system_error> +#include <utility> + +using namespace clang; +using namespace driver; Command::Command(const Action &Source, const Tool &Creator, const char *Executable, const ArgStringList &Arguments, ArrayRef<InputInfo> Inputs) : Source(Source), Creator(Creator), Executable(Executable), - Arguments(Arguments), ResponseFile(nullptr) { + Arguments(Arguments) { for (const auto &II : Inputs) if (II.isFilename()) InputFilenames.push_back(II.getFilename()); @@ -67,7 +71,7 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int &SkipNum, .Cases("-iframework", "-include-pch", true) .Default(false); if (IsInclude) - return HaveCrashVFS ? false : true; + return !HaveCrashVFS; // The remaining flags are treated as a single argument. @@ -86,7 +90,7 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, int &SkipNum, StringRef FlagRef(Flag); IsInclude = FlagRef.startswith("-F") || FlagRef.startswith("-I"); if (IsInclude) - return HaveCrashVFS ? false : true; + return !HaveCrashVFS; if (FlagRef.startswith("-fmodules-cache-path=")) return true; @@ -104,7 +108,7 @@ void Command::printArg(raw_ostream &OS, StringRef Arg, bool Quote) { // Quote and escape. This isn't really complete, but good enough. OS << '"'; - for (const char c : Arg) { + for (const auto c : Arg) { if (c == '"' || c == '\\' || c == '$') OS << '\\'; OS << c; @@ -115,7 +119,7 @@ void Command::printArg(raw_ostream &OS, StringRef Arg, bool Quote) { void Command::writeResponseFile(raw_ostream &OS) const { // In a file list, we only write the set of inputs to the response file if (Creator.getResponseFilesSupport() == Tool::RF_FileList) { - for (const char *Arg : InputFileList) { + for (const auto *Arg : InputFileList) { OS << Arg << '\n'; } return; @@ -124,7 +128,7 @@ void Command::writeResponseFile(raw_ostream &OS) const { // In regular response files, we send all arguments to the response file. // Wrapping all arguments in double quotes ensures that both Unix tools and // Windows tools understand the response file. - for (const char *Arg : Arguments) { + for (const auto *Arg : Arguments) { OS << '"'; for (; *Arg != '\0'; Arg++) { @@ -150,13 +154,13 @@ void Command::buildArgvForResponseFile( } llvm::StringSet<> Inputs; - for (const char *InputName : InputFileList) + for (const auto *InputName : InputFileList) Inputs.insert(InputName); Out.push_back(Executable); // In a file list, build args vector ignoring parameters that will go in the // response file (elements of the InputFileList vector) bool FirstInput = true; - for (const char *Arg : Arguments) { + for (const auto *Arg : Arguments) { if (Inputs.count(Arg) == 0) { Out.push_back(Arg); } else if (FirstInput) { @@ -174,6 +178,7 @@ rewriteIncludes(const llvm::ArrayRef<const char *> &Args, size_t Idx, llvm::SmallVectorImpl<llvm::SmallString<128>> &IncFlags) { using namespace llvm; using namespace sys; + auto getAbsPath = [](StringRef InInc, SmallVectorImpl<char> &OutInc) -> bool { if (path::is_absolute(InInc)) // Nothing to do here... return false; @@ -212,8 +217,8 @@ void Command::Print(raw_ostream &OS, const char *Terminator, bool Quote, OS << ' '; printArg(OS, Executable, /*Quote=*/true); - llvm::ArrayRef<const char *> Args = Arguments; - llvm::SmallVector<const char *, 128> ArgsRespFile; + ArrayRef<const char *> Args = Arguments; + SmallVector<const char *, 128> ArgsRespFile; if (ResponseFile != nullptr) { buildArgvForResponseFile(ArgsRespFile); Args = ArrayRef<const char *>(ArgsRespFile).slice(1); // no executable name diff --git a/clang/lib/Driver/Multilib.cpp b/clang/lib/Driver/Multilib.cpp index 16a81603b31..178a60db60e 100644 --- a/clang/lib/Driver/Multilib.cpp +++ b/clang/lib/Driver/Multilib.cpp @@ -1,4 +1,4 @@ -//===--- Multilib.cpp - Multilib Implementation ---------------------------===// +//===- Multilib.cpp - Multilib Implementation -----------------------------===// // // The LLVM Compiler Infrastructure // @@ -8,25 +8,22 @@ //===----------------------------------------------------------------------===// #include "clang/Driver/Multilib.h" -#include "ToolChains/CommonArgs.h" -#include "clang/Driver/Options.h" +#include "clang/Basic/LLVM.h" +#include "llvm/ADT/SmallString.h" #include "llvm/ADT/StringMap.h" #include "llvm/ADT/StringRef.h" #include "llvm/ADT/StringSet.h" -#include "llvm/Option/Arg.h" -#include "llvm/Option/ArgList.h" -#include "llvm/Option/OptTable.h" -#include "llvm/Option/Option.h" +#include "llvm/Support/Compiler.h" +#include "llvm/Support/ErrorHandling.h" #include "llvm/Support/Path.h" #include "llvm/Support/Regex.h" -#include "llvm/Support/YAMLParser.h" -#include "llvm/Support/YAMLTraits.h" #include "llvm/Support/raw_ostream.h" #include <algorithm> +#include <cassert> +#include <string> -using namespace clang::driver; using namespace clang; -using namespace llvm::opt; +using namespace driver; using namespace llvm::sys; /// normalize Segment to "/foo/bar" or "". @@ -34,7 +31,7 @@ static void normalizePathSegment(std::string &Segment) { StringRef seg = Segment; // Prune trailing "/" or "./" - while (1) { + while (true) { StringRef last = path::filename(seg); if (last != ".") break; @@ -42,7 +39,7 @@ static void normalizePathSegment(std::string &Segment) { } if (seg.empty() || seg == "/") { - Segment = ""; + Segment.clear(); return; } @@ -198,8 +195,8 @@ MultilibSet &MultilibSet::Either(ArrayRef<Multilib> MultilibSegments) { Multilibs.insert(Multilibs.end(), MultilibSegments.begin(), MultilibSegments.end()); else { - for (const Multilib &New : MultilibSegments) { - for (const Multilib &Base : *this) { + for (const auto &New : MultilibSegments) { + for (const auto &Base : *this) { Multilib MO = compose(Base, New); if (MO.isValid()) Composed.push_back(MO); @@ -262,7 +259,7 @@ bool MultilibSet::select(const Multilib::flags_list &Flags, Multilib &M) const { return false; }, Multilibs); - if (Filtered.size() == 0) + if (Filtered.empty()) return false; if (Filtered.size() == 1) { M = Filtered[0]; @@ -279,7 +276,7 @@ LLVM_DUMP_METHOD void MultilibSet::dump() const { } void MultilibSet::print(raw_ostream &OS) const { - for (const Multilib &M : *this) + for (const auto &M : *this) OS << M << "\n"; } diff --git a/clang/lib/Driver/ToolChain.cpp b/clang/lib/Driver/ToolChain.cpp index ea0554b3f9b..645f3575301 100644 --- a/clang/lib/Driver/ToolChain.cpp +++ b/clang/lib/Driver/ToolChain.cpp @@ -1,4 +1,4 @@ -//===--- ToolChain.cpp - Collections of tools for one platform ------------===// +//===- ToolChain.cpp - Collections of tools for one platform --------------===// // // The LLVM Compiler Infrastructure // @@ -8,33 +8,45 @@ //===----------------------------------------------------------------------===// #include "clang/Driver/ToolChain.h" -#include "ToolChains/CommonArgs.h" +#include "InputInfo.h" #include "ToolChains/Arch/ARM.h" #include "ToolChains/Clang.h" #include "clang/Basic/ObjCRuntime.h" +#include "clang/Basic/Sanitizers.h" +#include "clang/Basic/VersionTuple.h" #include "clang/Basic/VirtualFileSystem.h" #include "clang/Config/config.h" #include "clang/Driver/Action.h" #include "clang/Driver/Driver.h" #include "clang/Driver/DriverDiagnostic.h" +#include "clang/Driver/Job.h" #include "clang/Driver/Options.h" #include "clang/Driver/SanitizerArgs.h" #include "clang/Driver/XRayArgs.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Triple.h" +#include "llvm/ADT/Twine.h" +#include "llvm/Config/llvm-config.h" #include "llvm/Option/Arg.h" #include "llvm/Option/ArgList.h" +#include "llvm/Option/OptTable.h" #include "llvm/Option/Option.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/Path.h" -#include "llvm/MC/MCAsmInfo.h" -#include "llvm/MC/MCRegisterInfo.h" +#include "llvm/MC/MCTargetOptions.h" #include "llvm/Support/TargetParser.h" #include "llvm/Support/TargetRegistry.h" +#include <cassert> +#include <cstddef> +#include <cstring> +#include <string> -using namespace clang::driver; -using namespace clang::driver::tools; using namespace clang; +using namespace driver; +using namespace tools; using namespace llvm; using namespace llvm::opt; @@ -74,8 +86,7 @@ static ToolChain::RTTIMode CalculateRTTIMode(const ArgList &Args, ToolChain::ToolChain(const Driver &D, const llvm::Triple &T, const ArgList &Args) : D(D), Triple(T), Args(Args), CachedRTTIArg(GetRTTIArgument(Args)), - CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)), - EffectiveTriple() { + CachedRTTIMode(CalculateRTTIMode(Args, Triple, CachedRTTIArg)) { std::string CandidateLibPath = getArchSpecificLibPath(); if (getVFS().exists(CandidateLibPath)) getFilePaths().push_back(CandidateLibPath); @@ -87,8 +98,7 @@ void ToolChain::setTripleEnvironment(llvm::Triple::EnvironmentType Env) { EffectiveTriple.setEnvironment(Env); } -ToolChain::~ToolChain() { -} +ToolChain::~ToolChain() = default; vfs::FileSystem &ToolChain::getVFS() const { return getDriver().getVFS(); } @@ -115,12 +125,15 @@ const XRayArgs& ToolChain::getXRayArgs() const { } namespace { + struct DriverSuffix { const char *Suffix; const char *ModeFlag; }; -const DriverSuffix *FindDriverSuffix(StringRef ProgName, size_t &Pos) { +} // namespace + +static const DriverSuffix *FindDriverSuffix(StringRef ProgName, size_t &Pos) { // A list of known driver suffixes. Suffixes are compared against the // program name in order. If there is a match, the frontend type is updated as // necessary by applying the ModeFlag. @@ -151,7 +164,7 @@ const DriverSuffix *FindDriverSuffix(StringRef ProgName, size_t &Pos) { /// Normalize the program name from argv[0] by stripping the file extension if /// present and lower-casing the string on Windows. -std::string normalizeProgramName(llvm::StringRef Argv0) { +static std::string normalizeProgramName(llvm::StringRef Argv0) { std::string ProgName = llvm::sys::path::stem(Argv0); #ifdef LLVM_ON_WIN32 // Transform to lowercase for case insensitive file systems. @@ -160,7 +173,7 @@ std::string normalizeProgramName(llvm::StringRef Argv0) { return ProgName; } -const DriverSuffix *parseDriverSuffix(StringRef ProgName, size_t &Pos) { +static const DriverSuffix *parseDriverSuffix(StringRef ProgName, size_t &Pos) { // Try to infer frontend type and default target from the program name by // comparing it against DriverSuffixes in order. @@ -185,7 +198,6 @@ const DriverSuffix *parseDriverSuffix(StringRef ProgName, size_t &Pos) { } return DS; } -} // anonymous namespace ParsedClangName ToolChain::getTargetAndModeFromProgramName(StringRef PN) { @@ -193,7 +205,7 @@ ToolChain::getTargetAndModeFromProgramName(StringRef PN) { size_t SuffixPos; const DriverSuffix *DS = parseDriverSuffix(ProgName, SuffixPos); if (!DS) - return ParsedClangName(); + return {}; size_t SuffixEnd = SuffixPos + strlen(DS->Suffix); size_t LastComponent = ProgName.rfind('-', SuffixPos); @@ -589,7 +601,7 @@ std::string ToolChain::ComputeLLVMTriple(const ArgList &Args, // CollectArgsForIntegratedAssembler but we can't change the ArchName at // that point. There is no assembler equivalent of -mno-thumb, -marm, or // -mno-arm. - for (const Arg *A : + for (const auto *A : Args.filtered(options::OPT_Wa_COMMA, options::OPT_Xassembler)) { for (StringRef Value : A->getValues()) { if (Value == "-mthumb") @@ -707,7 +719,7 @@ void ToolChain::addExternCSystemIncludeIfExists(const ArgList &DriverArgs, /*static*/ void ToolChain::addSystemIncludes(const ArgList &DriverArgs, ArgStringList &CC1Args, ArrayRef<StringRef> Paths) { - for (StringRef Path : Paths) { + for (const auto Path : Paths) { CC1Args.push_back("-internal-isystem"); CC1Args.push_back(DriverArgs.MakeArgString(Path)); } @@ -789,7 +801,9 @@ bool ToolChain::AddFastMathRuntimeIfAvailable(const ArgList &Args, SanitizerMask ToolChain::getSupportedSanitizers() const { // Return sanitizers which don't require runtime support and are not // platform dependent. + using namespace SanitizerKind; + SanitizerMask Res = (Undefined & ~Vptr & ~Function) | (CFI & ~CFIICall) | CFICastStrict | UnsignedIntegerOverflow | Nullability | LocalBounds; @@ -871,7 +885,7 @@ llvm::opt::DerivedArgList *ToolChain::TranslateOpenMPTargetArgs( bool Modified = false; // Handle -Xopenmp-target flags - for (Arg *A : Args) { + for (auto *A : Args) { // Exclude flags which may only apply to the host toolchain. // Do not exclude flags when the host triple (AuxTriple) // matches the current toolchain triple. If it is not present |