10 #ifndef LLVM_CLANG_DRIVER_MULTILIB_H
11 #define LLVM_CLANG_DRIVER_MULTILIB_H
14 #include "llvm/ADT/STLExtras.h"
15 #include "llvm/ADT/Triple.h"
16 #include "llvm/Option/Option.h"
31 std::string GCCSuffix;
33 std::string IncludeSuffix;
37 Multilib(StringRef GCCSuffix =
"", StringRef OSSuffix =
"",
38 StringRef IncludeSuffix =
"");
43 assert(GCCSuffix.empty() ||
44 (StringRef(GCCSuffix).front() ==
'/' && GCCSuffix.size() > 1));
53 assert(OSSuffix.empty() ||
54 (StringRef(OSSuffix).front() ==
'/' && OSSuffix.size() > 1));
63 assert(IncludeSuffix.empty() ||
64 (StringRef(IncludeSuffix).front() ==
'/' && IncludeSuffix.size() > 1));
76 assert(F.front() ==
'+' || F.front() ==
'-');
82 void print(raw_ostream &OS)
const;
89 {
return GCCSuffix.empty() && OSSuffix.empty() && IncludeSuffix.empty(); }
94 raw_ostream &
operator<<(raw_ostream &OS,
const Multilib &M);
102 typedef std::function<std::vector<std::string>(
103 StringRef InstallDir, StringRef Triple,
const Multilib &M)>
152 unsigned size()
const {
return Multilibs.size(); }
154 void print(raw_ostream &OS)
const;
157 IncludeCallback = std::move(F);
170 raw_ostream &
operator<<(raw_ostream &OS,
const MultilibSet &MS);
MultilibSet & Either(const Multilib &M1, const Multilib &M2)
Add a set of mutually incompatible Multilib segments.
MultilibSet & Maybe(const Multilib &M)
Add an optional Multilib segment.
const std::string & includeSuffix() const
Get the include directory suffix. Always starts with a '/', unless empty.
const std::string & osSuffix() const
Get the detected os path suffix for the multi-arch target variant. Always starts with a '/'...
multilib_list::iterator iterator
llvm::function_ref< bool(const Multilib &)> FilterCallback
Multilib & flag(StringRef F)
Add a flag to the flags list.
const flags_list & flags() const
Get the flags that indicate or contraindicate this multilib's use All elements begin with either '+' ...
raw_ostream & operator<<(raw_ostream &OS, const Multilib &M)
const std::string & gccSuffix() const
Get the detected GCC installation path suffix for the multi-arch target variant. Always starts with a...
void clear()
Remove all of thie multilibs from the set.
void combineWith(const MultilibSet &MS)
Union this set of multilibs with another.
std::vector< Multilib > multilib_list
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
MultilibSet & setIncludeDirsCallback(IncludeDirsFunc F)
void push_back(const Multilib &M)
Add a completed Multilib to the set.
multilib_list::const_iterator const_iterator
std::function< std::vector< std::string > StringRef InstallDir, StringRef Triple, const Multilib &M)> IncludeDirsFunc
const_iterator end() const
Multilib(StringRef GCCSuffix="", StringRef OSSuffix="", StringRef IncludeSuffix="")
const_iterator begin() const
bool isDefault() const
Check whether the default is selected.
bool operator==(const Multilib &Other) const
void print(raw_ostream &OS) const
print summary of the Multilib
MultilibSet & FilterOut(FilterCallback F)
Filter out some subset of the Multilibs using a user defined callback.
bool isValid() const
Check whether any of the 'against' flags contradict the 'for' flags.
std::vector< std::string > flags_list
bool select(const Multilib::flags_list &Flags, Multilib &M) const
Pick the best multilib in the set,.
const IncludeDirsFunc & includeDirsCallback() const
void print(raw_ostream &OS) const