Bug#8945: Add -cxx-isystem option to specify C++ system directories.

It works like -isystem and the search path keeps -isystem and
-cxx-isystem in order relative to each other. -cxx-isystem is only used
for C++ sources though. Drop the existing -cxx-system-include option for
cc1 as it is now redundant.

llvm-svn: 126167
This commit is contained in:
Joerg Sonnenberger
2011-02-22 00:40:56 +00:00
parent 59006e4338
commit cc9c8eb837
5 changed files with 74 additions and 45 deletions

View File

@@ -490,6 +490,8 @@ static void HeaderSearchOptsToArgs(const HeaderSearchOptions &Opts,
Res.push_back("-iquote");
} else if (E.Group == frontend::System) {
Res.push_back("-isystem");
} else if (E.Group == frontend::CXXSystem) {
Res.push_back("-cxx-isystem");
} else {
assert(E.Group == frontend::Angled && "Invalid group!");
Res.push_back(E.IsFramework ? "-F" : "-I");
@@ -1236,7 +1238,6 @@ std::string CompilerInvocation::GetResourcesPath(const char *Argv0,
static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
using namespace cc1options;
Opts.CXXSystemIncludes = Args.getAllArgValues(OPT_cxx_system_include);
Opts.Sysroot = Args.getLastArgValue(OPT_isysroot, "/");
Opts.Verbose = Args.hasArg(OPT_v);
Opts.UseBuiltinIncludes = !Args.hasArg(OPT_nobuiltininc);
@@ -1272,10 +1273,12 @@ static void ParseHeaderSearchArgs(HeaderSearchOptions &Opts, ArgList &Args) {
for (arg_iterator it = Args.filtered_begin(OPT_iquote),
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::Quoted, true, false, true);
for (arg_iterator it = Args.filtered_begin(OPT_isystem, OPT_iwithsysroot),
ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args), frontend::System, true, false,
(*it)->getOption().matches(OPT_iwithsysroot));
for (arg_iterator it = Args.filtered_begin(OPT_cxx_isystem, OPT_isystem,
OPT_iwithsysroot), ie = Args.filtered_end(); it != ie; ++it)
Opts.AddPath((*it)->getValue(Args),
((*it)->getOption().matches(OPT_cxx_isystem) ?
frontend::CXXSystem : frontend::System),
true, false, (*it)->getOption().matches(OPT_iwithsysroot));
// FIXME: Need options for the various environment variables!
}