/// The path to the compiler resource directory.
std::string ResourceDir;
+ /// A prefix directory used to emulated a limited subset of GCC's '-Bprefix'
+ /// functionality.
+ /// FIXME: This type of customization should be removed in favor of the
+ /// universal driver when it is ready.
+ std::string PrefixDir;
+
/// Default host triple.
std::string DefaultHostTriple;
def _HASH_HASH_HASH : Flag<"-###">, Flags<[DriverOption]>,
HelpText<"Print the commands to run for this compilation">;
def A : JoinedOrSeparate<"-A">;
-def B : JoinedOrSeparate<"-B">, Flags<[Unsupported]>;
+def B : JoinedOrSeparate<"-B">;
def CC : Flag<"-CC">;
def C : Flag<"-C">;
def D : JoinedOrSeparate<"-D">, Group<CompileOnly_Group>;
HostTriple = A->getValue(*Args);
if (const Arg *A = Args->getLastArg(options::OPT_ccc_install_dir))
Dir = A->getValue(*Args);
+ if (const Arg *A = Args->getLastArg(options::OPT_B))
+ PrefixDir = A->getValue(*Args);
Host = GetHostInfo(HostTriple);
}
std::string Driver::GetFilePath(const char *Name, const ToolChain &TC) const {
+ // Respect a limited subset of the '-Bprefix' functionality in GCC by
+ // attempting to use this prefix when lokup up program paths.
+ if (!PrefixDir.empty()) {
+ llvm::sys::Path P(PrefixDir);
+ P.appendComponent(Name);
+ if (P.exists())
+ return P.str();
+ }
+
const ToolChain::path_list &List = TC.getFilePaths();
for (ToolChain::path_list::const_iterator
it = List.begin(), ie = List.end(); it != ie; ++it) {
std::string Driver::GetProgramPath(const char *Name, const ToolChain &TC,
bool WantFile) const {
+ // Respect a limited subset of the '-Bprefix' functionality in GCC by
+ // attempting to use this prefix when lokup up program paths.
+ if (!PrefixDir.empty()) {
+ llvm::sys::Path P(PrefixDir);
+ P.appendComponent(Name);
+ if (WantFile ? P.exists() : P.canExecute())
+ return P.str();
+ }
+
const ToolChain::path_list &List = TC.getProgramPaths();
for (ToolChain::path_list::const_iterator
it = List.begin(), ie = List.end(); it != ie; ++it) {