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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126167 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 103d251..915634b 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -490,6 +490,8 @@
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 @@
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 @@
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!
}