Frontend: Add -cxx-system-include option which can be used to specify an
explicit list for the C++ system include directories at the -cc1 level, as an
alternative to the horrible AddDefaultCPlusPlusIncludePaths().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@113505 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp
index 8c64483..36d8dad 100644
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -443,6 +443,11 @@
Res.push_back(Opts.Sysroot);
}
+ for (unsigned i = 0, e = Opts.CXXSystemIncludes.size(); i != e; ++i) {
+ Res.push_back("-cxx-system-include");
+ Res.push_back(Opts.CXXSystemIncludes[i]);
+ }
+
/// User specified include entries.
for (unsigned i = 0, e = Opts.UserEntries.size(); i != e; ++i) {
const HeaderSearchOptions::Entry &E = Opts.UserEntries[i];
@@ -1143,6 +1148,7 @@
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);