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,
32 StringRef SysRoot)
const {
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);
73 #ifdef ENABLE_LINKER_BUILD_ID 81 if (StringRef(D.
Dir).startswith(SysRoot)) {
96 if (StringRef(D.
Dir).startswith(SysRoot))
115 return std::string();
119 if (
getArch() == llvm::Triple::x86)
122 llvm_unreachable(
"unsupported architecture");
126 ArgStringList &CC1Args)
const {
130 if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
133 if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
136 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
138 llvm::sys::path::append(P,
"include");
142 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
146 StringRef CIncludeDirs(C_INCLUDE_DIRS);
147 if (CIncludeDirs !=
"") {
149 CIncludeDirs.split(Dirs,
":");
150 for (StringRef Dir : Dirs) {
152 llvm::sys::path::is_absolute(Dir) ? StringRef(SysRoot) :
"";
161 std::string Path = SysRoot +
"/usr/include/i386-gnu";
162 if (D.
getVFS().exists(Path))
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.