diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-26 17:47:35 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-26 17:47:35 +0000 |
commit | dd9a319158fa75b218f09276012274cb21482c60 (patch) | |
tree | ae84315266958f6d9e3565c90e393d9263560570 | |
parent | 0c6aad373f3657f156364d10ccd47418ea8e081e (diff) | |
download | bcm5719-llvm-dd9a319158fa75b218f09276012274cb21482c60.tar.gz bcm5719-llvm-dd9a319158fa75b218f09276012274cb21482c60.zip |
Add isysroot support, patch by Keith Bauer
llvm-svn: 41455
-rw-r--r-- | clang/Driver/clang.cpp | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/clang/Driver/clang.cpp b/clang/Driver/clang.cpp index d284434bedd..14f48870e5a 100644 --- a/clang/Driver/clang.cpp +++ b/clang/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<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 std::vector<DirectoryLookup> 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", |