11#include "clang/Config/config.h"
14#include "llvm/Support/Path.h"
15#include "llvm/Support/VirtualFileSystem.h"
31 const llvm::Triple &TargetTriple,
32 StringRef SysRoot)
const {
33 switch (TargetTriple.getArch()) {
37 case llvm::Triple::x86:
42 if (
D.getVFS().exists(SysRoot +
"/lib/i386-gnu"))
46 case llvm::Triple::x86_64:
52 return TargetTriple.str();
55static StringRef
getOSLibDir(
const llvm::Triple &Triple,
const ArgList &Args) {
66 if (Triple.getArch() == llvm::Triple::x86)
69 return Triple.isArch32Bit() ?
"lib" :
"lib64";
89 const std::string OSLibDir = std::string(
getOSLibDir(Triple, Args));
92#ifdef ENABLE_LINKER_BUILD_ID
103 if (StringRef(
D.Dir).starts_with(SysRoot)) {
104 addPathIfExists(
D,
D.Dir +
"/../lib/" + MultiarchTriple, Paths);
105 addPathIfExists(
D,
D.Dir +
"/../" + OSLibDir, Paths);
108 addPathIfExists(
D, SysRoot +
"/lib/" + MultiarchTriple, Paths);
109 addPathIfExists(
D, SysRoot +
"/lib/../" + OSLibDir, Paths);
111 addPathIfExists(
D, SysRoot +
"/usr/lib/" + MultiarchTriple, Paths);
112 addPathIfExists(
D, SysRoot +
"/usr/lib/../" + OSLibDir, Paths);
121 if (StringRef(
D.Dir).starts_with(SysRoot))
122 addPathIfExists(
D,
D.Dir +
"/../lib", Paths);
124 addPathIfExists(
D, SysRoot +
"/lib", Paths);
125 addPathIfExists(
D, SysRoot +
"/usr/lib", Paths);
138 case llvm::Triple::x86:
140 case llvm::Triple::x86_64:
141 return "/lib/ld-x86-64.so.1";
146 llvm_unreachable(
"unsupported architecture");
150 ArgStringList &CC1Args)
const {
154 if (DriverArgs.hasArg(clang::driver::options::OPT_nostdinc))
157 if (!DriverArgs.hasArg(options::OPT_nostdlibinc))
160 if (!DriverArgs.hasArg(options::OPT_nobuiltininc)) {
162 llvm::sys::path::append(
P,
"include");
166 if (DriverArgs.hasArg(options::OPT_nostdlibinc))
170 StringRef CIncludeDirs(C_INCLUDE_DIRS);
171 if (CIncludeDirs !=
"") {
173 CIncludeDirs.split(Dirs,
":");
174 for (StringRef Dir : Dirs) {
176 llvm::sys::path::is_absolute(Dir) ?
"" : StringRef(SysRoot);
190 if (!MultiarchIncludeDir.empty() &&
191 D.getVFS().exists(SysRoot +
"/usr/include/" + MultiarchIncludeDir))
193 SysRoot +
"/usr/include/" + MultiarchIncludeDir);
204 llvm::opt::ArgStringList &CC1Args)
const {
211 StringRef DebianMultiarch =
220 CmdArgs.push_back(Opt.c_str());
static StringRef getOSLibDir(const llvm::Triple &Triple, const ArgList &Args)
Driver - Encapsulate logic for constructing compilation processes from a set of gcc-driver-like comma...
The JSON file list parser is used to communicate input to InstallAPI.