13 #include "clang/Config/config.h" 17 #include "llvm/Option/ArgList.h" 18 #include "llvm/Support/FileSystem.h" 19 #include "llvm/Support/Path.h" 23 using namespace clang;
28 const llvm::Triple &Triple,
30 :
Linux(D, Triple, Args) {
44 const ArgList &DriverArgs, ArgStringList &CC1Args)
const {
45 if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
50 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
52 llvm::sys::path::append(P,
"include");
56 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
61 for (
const auto &Path : Callback(SelectedMultilib))
75 const std::string InstalledDir(
getDriver().getInstalledDir());
76 std::string SysRootPath =
77 InstalledDir +
"/../sysroot" + SelectedMultilib.
osSuffix();
78 if (llvm::sys::fs::exists(SysRootPath))
86 Arg *A = Args.getLastArg(options::OPT_stdlib_EQ);
88 StringRef
Value = A->getValue();
89 if (Value !=
"libc++")
91 << A->getAsString(Args);
99 for (std::string Path : Callback(SelectedMultilib)) {
101 if (llvm::sys::fs::exists(Path)) {
110 ArgStringList &CmdArgs)
const {
112 "Only -lc++ (aka libxx) is supported in this toolchain.");
114 CmdArgs.push_back(
"-lc++");
115 CmdArgs.push_back(
"-lc++abi");
116 CmdArgs.push_back(
"-lunwind");
123 llvm::sys::path::append(Path, SelectedMultilib.
osSuffix(),
"lib" + LibSuffix,
125 llvm::sys::path::append(Path, Twine(
"libclang_rt." + Component +
"-" +
126 "mips" + (Shared ?
".so" :
".a")));
const IncludeDirsFunc & includeDirsCallback() const
DiagnosticBuilder Diag(unsigned DiagID) const
const std::string & osSuffix() const
Get the detected os path suffix for the multi-arch target variant.
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
Dataflow Directional Tag Classes.
std::string SysRoot
sysroot, if present
const char * getInstalledDir() const
Get the path to where the clang executable was installed.
bool findMIPSMultilibs(const Driver &D, const llvm::Triple &TargetTriple, StringRef Path, const llvm::opt::ArgList &Args, DetectedMultilibs &Result)
MultilibSet Multilibs
The set of multilibs that the detected installation supports.
Multilib SelectedMultilib
The primary multilib appropriate for the given flags.
std::string ResourceDir
The path to the compiler resource directory.