[PATCH] Driver: Add OS-specific resource directory to file search paths.

Shiz hi at shiz.me
Tue May 26 18:13:29 PDT 2015


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();
+  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/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D10049.26561.patch
Type: text/x-patch
Size: 754 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150527/977a9fb3/attachment.bin>


More information about the cfe-commits mailing list