9#ifndef LLVM_CLANG_DRIVER_MULTILIB_H
10#define LLVM_CLANG_DRIVER_MULTILIB_H
13#include "llvm/ADT/ArrayRef.h"
14#include "llvm/ADT/STLExtras.h"
15#include "llvm/ADT/StringRef.h"
16#include "llvm/ADT/StringSet.h"
17#include "llvm/Support/Compiler.h"
18#include "llvm/Support/SourceMgr.h"
37 std::string GCCSuffix;
39 std::string IncludeSuffix;
46 Multilib(StringRef GCCSuffix = {}, StringRef OSSuffix = {},
47 StringRef IncludeSuffix = {},
52 const std::string &
gccSuffix()
const {
return GCCSuffix; }
56 const std::string &
osSuffix()
const {
return OSSuffix; }
66 LLVM_DUMP_METHOD
void dump()
const;
68 void print(raw_ostream &OS)
const;
72 {
return GCCSuffix.empty() && OSSuffix.empty() && IncludeSuffix.empty(); }
77raw_ostream &
operator<<(raw_ostream &OS,
const Multilib &M);
85 std::function<std::vector<std::string>(
const Multilib &M)>;
98 std::vector<FlagMatcher> FlagMatchers;
105 std::vector<FlagMatcher> &&FlagMatchers = {})
106 : Multilibs(Multilibs), FlagMatchers(FlagMatchers) {}
123 unsigned size()
const {
return Multilibs.size(); }
130 LLVM_DUMP_METHOD
void dump()
const;
131 void print(raw_ostream &OS)
const;
134 IncludeCallback = std::move(F);
141 FilePathsCallback = std::move(F);
147 static llvm::ErrorOr<MultilibSet>
148 parseYaml(llvm::MemoryBufferRef, llvm::SourceMgr::DiagHandlerTy =
nullptr,
149 void *DiagHandlerCtxt =
nullptr);
152raw_ostream &
operator<<(raw_ostream &OS,
const MultilibSet &MS);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
See also MultilibSetBuilder for combining multilibs into a set.
bool select(const Multilib::flags_list &Flags, llvm::SmallVector< Multilib > &) const
Select compatible variants,.
MultilibSet & setFilePathsCallback(IncludeDirsFunc F)
LLVM_DUMP_METHOD void dump() const
llvm::function_ref< bool(const Multilib &)> FilterCallback
const_iterator end() const
const multilib_list & getMultilibs()
static llvm::ErrorOr< MultilibSet > parseYaml(llvm::MemoryBufferRef, llvm::SourceMgr::DiagHandlerTy=nullptr, void *DiagHandlerCtxt=nullptr)
void print(raw_ostream &OS) const
MultilibSet & FilterOut(FilterCallback F)
Filter out some subset of the Multilibs using a user defined callback.
std::vector< Multilib > multilib_list
const IncludeDirsFunc & filePathsCallback() const
MultilibSet(multilib_list &&Multilibs, std::vector< FlagMatcher > &&FlagMatchers={})
llvm::StringSet expandFlags(const Multilib::flags_list &) const
Get the given flags plus flags found by matching them against the FlagMatchers and choosing the Flags...
void push_back(const Multilib &M)
Add a completed Multilib to the set.
const IncludeDirsFunc & includeDirsCallback() const
MultilibSet & setIncludeDirsCallback(IncludeDirsFunc F)
multilib_list::const_iterator const_iterator
std::function< std::vector< std::string >(const Multilib &M)> IncludeDirsFunc
const_iterator begin() const
This corresponds to a single GCC Multilib, or a segment of one controlled by a command line flag.
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 isDefault() const
Check whether the default is selected.
bool operator==(const Multilib &Other) const
raw_ostream & operator<<(raw_ostream &OS, const Multilib &M)
Uses regular expressions to simplify flags used for multilib selection.
std::vector< std::string > Flags