From: Chris Lattner Date: Sun, 26 Aug 2007 17:47:35 +0000 (+0000) Subject: Add isysroot support, patch by Keith Bauer X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c946411566527d625c3ed68769f062ed1cb9931;p=clang Add isysroot support, patch by Keith Bauer git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41455 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/Driver/clang.cpp b/Driver/clang.cpp index d284434bed..14f48870e5 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -456,7 +456,7 @@ static void InitializePredefinedMacros(Preprocessor &PP, // 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 @@ iwithprefixbefore_vals("iwithprefixbefore", llvm::cl::value_desc("dir"), llvm::cl::Prefix, llvm::cl::desc("Set directory to include search path with prefix")); +static llvm::cl::opt +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 std::vector IncludeGroup[4]; 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",