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;
49 std::string ExclusiveGroup;
55 Multilib(StringRef GCCSuffix = {}, StringRef OSSuffix = {},
57 StringRef ExclusiveGroup = {});
61 const std::string &
gccSuffix()
const {
return GCCSuffix; }
65 const std::string &
osSuffix()
const {
return OSSuffix; }
78 LLVM_DUMP_METHOD
void dump()
const;
80 void print(raw_ostream &OS)
const;
84 {
return GCCSuffix.empty() && OSSuffix.empty() && IncludeSuffix.empty(); }
89raw_ostream &
operator<<(raw_ostream &OS,
const Multilib &M);
97 std::function<std::vector<std::string>(
const Multilib &M)>;
110 std::vector<FlagMatcher> FlagMatchers;
117 std::vector<FlagMatcher> &&FlagMatchers = {})
118 : Multilibs(Multilibs), FlagMatchers(FlagMatchers) {}
135 unsigned size()
const {
return Multilibs.size(); }
142 LLVM_DUMP_METHOD
void dump()
const;
143 void print(raw_ostream &OS)
const;
146 IncludeCallback = std::move(F);
153 FilePathsCallback = std::move(F);
159 static llvm::ErrorOr<MultilibSet>
160 parseYaml(llvm::MemoryBufferRef, llvm::SourceMgr::DiagHandlerTy =
nullptr,
161 void *DiagHandlerCtxt =
nullptr);
164raw_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.
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...
bool select(const Multilib::flags_list &Flags, llvm::SmallVectorImpl< Multilib > &) const
Select compatible variants,.
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
const std::string & exclusiveGroup() const
Get the exclusive group label.
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)
The JSON file list parser is used to communicate input to InstallAPI.
@ Other
Other implicit parameter.
Uses regular expressions to simplify flags used for multilib selection.
std::vector< std::string > Flags