[PATCH] Driver: Add OS-specific resource directory to file search paths.
Justin Bogner
mail at justinbogner.com
Tue May 26 20:18:14 PDT 2015
Shiz <hi at shiz.me> writes:
> This patch adds the OS-specific resource directory
> ($resourcedir/lib/$os) to the default file search paths when invoking
> Driver::GetFilePath.
> This allows it to find the non-generic files it may need, as well as
> making the GCC-compatible driver's -print-file-name work with e.g. the
> libclang_rt.*.a files.
>
> http://reviews.llvm.org/D10049
>
> Files:
> lib/Driver/Driver.cpp
>
> Index: lib/Driver/Driver.cpp
> ===================================================================
> --- lib/Driver/Driver.cpp
> +++ lib/Driver/Driver.cpp
> @@ -1857,6 +1857,14 @@
> if (llvm::sys::fs::exists(Twine(P)))
> return P.str();
>
> + P = ResourceDir;
> + // TC.getOSName() yields "freebsd10.0" whereas "freebsd" is expected.
> + StringRef OSLibName = (TC.getTriple().getOS() == llvm::Triple::FreeBSD)
> + ? "freebsd" : TC.getTriple().getOSName();
I've seen this check elsewhere, and it really needs to be abstracted in
some way if we're going to start doing it in more places. On a related
note, getOSName isn't correct here for the mach-o and darwin toolchains,
at least.
> + llvm::sys::path::append(P, "lib", OSLibName, Name);
> + if (llvm::sys::fs::exists(Twine(P)))
> + 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) {
>
> EMAIL PREFERENCES
> http://reviews.llvm.org/settings/panel/emailpreferences/
>
> _______________________________________________
> cfe-commits mailing list
> cfe-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
More information about the cfe-commits
mailing list