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"
40 std::string GCCSuffix;
42 std::string IncludeSuffix;
52 std::string ExclusiveGroup;
57 std::optional<std::string> Error;
63 Multilib(StringRef GCCSuffix = {}, StringRef OSSuffix = {},
65 StringRef ExclusiveGroup = {},
66 std::optional<StringRef>
Error = std::nullopt);
70 const std::string &
gccSuffix()
const {
return GCCSuffix; }
74 const std::string &
osSuffix()
const {
return OSSuffix; }
87 LLVM_DUMP_METHOD
void dump()
const;
89 void print(raw_ostream &OS)
const;
93 {
return GCCSuffix.empty() && OSSuffix.empty() && IncludeSuffix.empty(); }
97 bool isError()
const {
return Error.has_value(); }
102raw_ostream &
operator<<(raw_ostream &OS,
const Multilib &M);
110 std::function<std::vector<std::string>(
const Multilib &M)>;
123 std::vector<FlagMatcher> FlagMatchers;
130 std::vector<FlagMatcher> &&FlagMatchers = {})
131 : Multilibs(Multilibs), FlagMatchers(FlagMatchers) {}
148 unsigned size()
const {
return Multilibs.size(); }
155 LLVM_DUMP_METHOD
void dump()
const;
156 void print(raw_ostream &OS)
const;
159 IncludeCallback = std::move(F);
166 FilePathsCallback = std::move(F);
172 static llvm::ErrorOr<MultilibSet>
173 parseYaml(llvm::MemoryBufferRef, llvm::SourceMgr::DiagHandlerTy =
nullptr,
174 void *DiagHandlerCtxt =
nullptr);
177raw_ostream &
operator<<(raw_ostream &OS,
const MultilibSet &MS);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
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...
void push_back(const Multilib &M)
Add a completed Multilib to the set.
bool select(const Driver &D, const Multilib::flags_list &Flags, llvm::SmallVectorImpl< Multilib > &) const
Select compatible variants,.
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 & getErrorMessage() const
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.
bool(*)(llvm::ArrayRef< const char * >, llvm::raw_ostream &, llvm::raw_ostream &, bool, bool) Driver
Uses regular expressions to simplify flags used for multilib selection.
std::vector< std::string > Flags