11#include "llvm/ADT/SmallString.h"
12#include "llvm/ADT/StringMap.h"
13#include "llvm/ADT/StringRef.h"
14#include "llvm/ADT/StringSet.h"
15#include "llvm/Support/Compiler.h"
16#include "llvm/Support/ErrorHandling.h"
17#include "llvm/Support/Path.h"
18#include "llvm/Support/Regex.h"
19#include "llvm/Support/raw_ostream.h"
25using namespace driver;
26using namespace llvm::sys;
29 StringRef IncludeSuffix,
const flags_list &Flags)
30 : GCCSuffix(GCCSuffix), OSSuffix(OSSuffix), IncludeSuffix(IncludeSuffix),
32 assert(GCCSuffix.empty() ||
33 (StringRef(GCCSuffix).front() ==
'/' && GCCSuffix.size() > 1));
34 assert(OSSuffix.empty() ||
35 (StringRef(OSSuffix).front() ==
'/' && OSSuffix.size() > 1));
36 assert(IncludeSuffix.empty() ||
37 (StringRef(IncludeSuffix).front() ==
'/' && IncludeSuffix.size() > 1));
45 if (GCCSuffix.empty())
48 OS << StringRef(GCCSuffix).drop_front();
51 for (StringRef Flag : Flags) {
52 if (Flag.front() ==
'+')
53 OS <<
"@" << Flag.substr(1);
60 llvm::StringSet<> MyFlags;
61 for (
const auto &Flag : Flags)
64 for (
const auto &Flag : Other.Flags)
65 if (!MyFlags.contains(Flag))
86 llvm::erase_if(Multilibs, F);
94 llvm::StringSet<> FlagSet;
95 for (
const auto &Flag : Flags)
99 llvm::copy_if(Multilibs, std::back_inserter(
Result),
101 for (
const std::string &F : M.
flags())
102 if (!FlagSet.contains(F))
123 for (
const auto &M : *
this)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
See also MultilibSetBuilder for combining multilibs into a set.
LLVM_DUMP_METHOD void dump() const
llvm::function_ref< bool(const Multilib &)> FilterCallback
void print(raw_ostream &OS) const
MultilibSet & FilterOut(FilterCallback F)
Filter out some subset of the Multilibs using a user defined callback.
multilib_list select(const Multilib::flags_list &Flags) const
Select compatible variants.
std::vector< Multilib > multilib_list
void push_back(const Multilib &M)
Add a completed Multilib to the set.
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
Multilib(StringRef GCCSuffix={}, StringRef OSSuffix={}, StringRef IncludeSuffix={}, const flags_list &Flags=flags_list())
GCCSuffix, OSSuffix & IncludeSuffix will be appended directly to the sysroot string so they must eith...
const std::string & gccSuffix() const
Get the detected GCC installation path suffix for the multi-arch target variant.
const std::string & osSuffix() const
Get the detected os path suffix for the multi-arch target variant.
const flags_list & flags() const
Get the flags that indicate or contraindicate this multilib's use All elements begin with either '+' ...
std::vector< std::string > flags_list
const std::string & includeSuffix() const
Get the include directory suffix.
LLVM_DUMP_METHOD void dump() const
void print(raw_ostream &OS) const
print summary of the Multilib
bool operator==(const Multilib &Other) const
raw_ostream & operator<<(raw_ostream &OS, const Multilib &M)
@ Result
The result type of a method or function.
if(T->getSizeExpr()) TRY_TO(TraverseStmt(T -> getSizeExpr()))