11 #include "clang/Config/config.h" 14 #include "llvm/Support/Path.h" 15 #include "llvm/Support/VirtualFileSystem.h" 19 using namespace clang;
31 const llvm::Triple &TargetTriple,
33 if (TargetTriple.getArch() == llvm::Triple::x86) {
38 if (D.
getVFS().exists(SysRoot +
"/lib/i386-gnu"))
44 return TargetTriple.str();
47 static StringRef
getOSLibDir(
const llvm::Triple &Triple,
const ArgList &Args) {
58 if (Triple.getArch() == llvm::Triple::x86)
61 return Triple.isArch32Bit() ?
"lib" :
"lib64";
70 const std::string OSLibDir =
getOSLibDir(Triple, Args);
77 if (StringRef(D.
Dir).startswith(SysRoot)) {
92 if (StringRef(D.
Dir).startswith(SysRoot))
111 return std::string();
115 if (
getArch() == llvm::Triple::x86)
118 llvm_unreachable(
"unsupported architecture");
122 ArgStringList &CC1Args)
const {
126 if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
129 if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
132 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
134 llvm::sys::path::append(P,
"include");
138 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
142 StringRef CIncludeDirs(C_INCLUDE_DIRS);
143 if (CIncludeDirs !=
"") {
145 CIncludeDirs.split(Dirs,
":");
146 for (StringRef Dir : Dirs) {
148 llvm::sys::path::is_absolute(Dir) ? StringRef(SysRoot) :
"";
157 std::string Path = SysRoot +
"/usr/include/i386-gnu";
158 if (D.
getVFS().exists(Path))
static std::string getMultiarchTriple(const Driver &D, const llvm::Triple &TargetTriple, StringRef SysRoot)
Get our best guess at the multiarch triple for a target.
std::string Dir
The path the driver executable was in, as invoked from the command line.
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
llvm::vfs::FileSystem & getVFS() const
Dataflow Directional Tag Classes.
std::string SysRoot
sysroot, if present
static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args)
std::string ResourceDir
The path to the compiler resource directory.