diff options
author | Bob Wilson <bob.wilson@apple.com> | 2011-06-21 21:12:29 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2011-06-21 21:12:29 +0000 |
commit | b02ea3d70d83cf549059957775272334c5a4f60c (patch) | |
tree | af23f00c3da912135ac0eac473c3385ee8faa24d /clang/lib/Frontend | |
parent | 5464de6d90a4088153ceae53d86233fa12ff225d (diff) | |
download | bcm5719-llvm-b02ea3d70d83cf549059957775272334c5a4f60c.tar.gz bcm5719-llvm-b02ea3d70d83cf549059957775272334c5a4f60c.zip |
Fix the default libc++ header search path to be sysrooted. Radar 9639692.
The -cxx-isystem path is not prefixed with the sysroot directory, so it's
not a good way for the driver to set the system default C++ search path.
Instead, add -stdlib as a cc1 option and teach the frontend how to find the
headers. The driver can then just pass -stdlib through to "cc1".
llvm-svn: 133547
Diffstat (limited to 'clang/lib/Frontend')
-rw-r--r-- | clang/lib/Frontend/CompilerInvocation.cpp | 4 | ||||
-rw-r--r-- | clang/lib/Frontend/InitHeaderSearch.cpp | 8 |
2 files changed, 10 insertions, 2 deletions
diff --git a/clang/lib/Frontend/CompilerInvocation.cpp b/clang/lib/Frontend/CompilerInvocation.cpp index 61887e8eb2a..cf1feb7f6f2 100644 --- a/clang/lib/Frontend/CompilerInvocation.cpp +++ b/clang/lib/Frontend/CompilerInvocation.cpp @@ -553,6 +553,8 @@ static void HeaderSearchOptsToArgs(const HeaderSearchOptions &Opts, Res.push_back("-nostdinc"); if (!Opts.UseStandardCXXIncludes) Res.push_back("-nostdinc++"); + if (Opts.UseLibcxx) + Res.push_back("-stdlib=libc++"); if (Opts.Verbose) Res.push_back("-v"); } @@ -1330,6 +1332,8 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) { Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc); Opts.UseStandardIncludes = !Args.hasArg(OPT_nostdinc); Opts.UseStandardCXXIncludes = !Args.hasArg(OPT_nostdincxx); + if (const Arg *A = Args.getLastArg(OPT_stdlib_EQ)) + Opts.UseLibcxx = (strcmp(A->getValue(Args), "libc++") == 0); Opts.ResourceDir = Args.getLastArgValue(OPT_resource_dir); // Add -I... and -F... options in order. diff --git a/clang/lib/Frontend/InitHeaderSearch.cpp b/clang/lib/Frontend/InitHeaderSearch.cpp index f94edc65b98..238ff7fdc8a 100644 --- a/clang/lib/Frontend/InitHeaderSearch.cpp +++ b/clang/lib/Frontend/InitHeaderSearch.cpp @@ -920,8 +920,12 @@ AddDefaultCPlusPlusIncludePaths(const llvm::Triple &triple) { void InitHeaderSearch::AddDefaultSystemIncludePaths(const LangOptions &Lang, const llvm::Triple &triple, const HeaderSearchOptions &HSOpts) { - if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes) - AddDefaultCPlusPlusIncludePaths(triple); + if (Lang.CPlusPlus && HSOpts.UseStandardCXXIncludes) { + if (HSOpts.UseLibcxx) + AddPath("/usr/include/c++/v1", CXXSystem, true, false, false); + else + AddDefaultCPlusPlusIncludePaths(triple); + } AddDefaultCIncludePaths(triple, HSOpts); |