diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-28 11:06:01 +0000 |
commit | 486754660bb926339aefcf012a3f848592babb8b (patch) | |
tree | ecdbc446c9876f4f120f701c243373cd3cb43db3 /lib/Driver/Multilib.cpp | |
parent | 55e6d896ad333f07bb3b1ba487df214fc268a4ab (diff) |
Notes
Diffstat (limited to 'lib/Driver/Multilib.cpp')
-rw-r--r-- | lib/Driver/Multilib.cpp | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/lib/Driver/Multilib.cpp b/lib/Driver/Multilib.cpp index 16a81603b31e2..178a60db60e5d 100644 --- a/lib/Driver/Multilib.cpp +++ b/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"; } |