12 #include "clang/Config/config.h" 15 #include "llvm/Support/Path.h" 16 #include "llvm/Support/VirtualFileSystem.h" 20 using namespace clang;
32 const llvm::Triple &TargetTriple,
34 if (TargetTriple.getArch() == llvm::Triple::x86) {
39 if (D.
getVFS().exists(SysRoot +
"/lib/i386-gnu"))
45 return TargetTriple.str();
48 static StringRef
getOSLibDir(
const llvm::Triple &Triple,
const ArgList &Args) {
59 if (Triple.getArch() == llvm::Triple::x86)
62 return Triple.isArch32Bit() ?
"lib" :
"lib64";
71 const std::string OSLibDir =
getOSLibDir(Triple, Args);
78 if (StringRef(D.
Dir).startswith(SysRoot)) {
93 if (StringRef(D.
Dir).startswith(SysRoot))
112 return std::string();
116 if (
getArch() == llvm::Triple::x86)
119 llvm_unreachable(
"unsupported architecture");
123 ArgStringList &CC1Args)
const {
127 if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
130 if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
133 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
135 llvm::sys::path::append(P,
"include");
139 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
143 StringRef CIncludeDirs(C_INCLUDE_DIRS);
144 if (CIncludeDirs !=
"") {
146 CIncludeDirs.split(Dirs,
":");
147 for (StringRef Dir : Dirs) {
149 llvm::sys::path::is_absolute(Dir) ? StringRef(SysRoot) :
"";
158 std::string Path = SysRoot +
"/usr/include/i386-gnu";
159 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.