[cfe-commits] r41455 - /cfe/trunk/Driver/clang.cpp

Chris Lattner sabre at nondot.org
Sun Aug 26 10:47:35 PDT 2007


Author: lattner
Date: Sun Aug 26 12:47:35 2007
New Revision: 41455

URL: http://llvm.org/viewvc/llvm-project?rev=41455&view=rev
Log:
Add isysroot support, patch by Keith Bauer


Modified:
    cfe/trunk/Driver/clang.cpp

Modified: cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Driver/clang.cpp?rev=41455&r1=41454&r2=41455&view=diff

==============================================================================
--- cfe/trunk/Driver/clang.cpp (original)
+++ cfe/trunk/Driver/clang.cpp Sun Aug 26 12:47:35 2007
@@ -456,7 +456,7 @@
 // object takes a very simple interface: a list of directories to search for
 // 
 // FIXME: -nostdinc,-nostdinc++
-// FIXME: -isysroot,-imultilib
+// FIXME: -imultilib
 //
 // FIXME: -include,-imacros
 
@@ -492,6 +492,10 @@
                        llvm::cl::Prefix,
             llvm::cl::desc("Set directory to include search path with prefix"));
 
+static llvm::cl::opt<std::string>
+isysroot("isysroot", llvm::cl::value_desc("dir"), llvm::cl::init("/"),
+         llvm::cl::desc("Set the system root directory (usually /)"));
+
 // Finally, implement the code that groks the options above.
 enum IncludeDirGroup {
   Quoted = 0,
@@ -507,7 +511,12 @@
 static void AddPath(const std::string &Path, IncludeDirGroup Group,
                     bool isCXXAware, bool isUserSupplied,
                     bool isFramework, FileManager &FM) {
-  const DirectoryEntry *DE = FM.getDirectory(Path);
+  const DirectoryEntry *DE;
+  if (Group == System)
+    DE = FM.getDirectory(isysroot + "/" + Path);
+  else
+    DE = FM.getDirectory(Path);
+  
   if (DE == 0) {
     if (Verbose)
       fprintf(stderr, "ignoring nonexistent directory \"%s\"\n",





More information about the cfe-commits mailing list