Driver: Only forward last instance of -mmacosx-version-min= and
-isysroot to clang.
- Don't forward arbitrary -i* options to clang, just the ones we know
about.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68553 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def
index bfa5a66..9e86a24 100644
--- a/include/clang/Driver/Options.def
+++ b/include/clang/Driver/Options.def
@@ -108,6 +108,7 @@
OPTION("<clang f group>", clang_f_Group, Group, f_Group, INVALID, "", 0, 0, 0)
OPTION("<g group>", g_Group, Group, INVALID, INVALID, "", 0, 0, 0)
OPTION("<i group>", i_Group, Group, INVALID, INVALID, "", 0, 0, 0)
+OPTION("<clang i group>", clang_i_Group, Group, i_Group, INVALID, "", 0, 0, 0)
OPTION("<m group>", m_Group, Group, INVALID, INVALID, "", 0, 0, 0)
OPTION("<u group>", u_Group, Group, INVALID, INVALID, "", 0, 0, 0)
@@ -518,18 +519,18 @@
OPTION("-g", g_Flag, Flag, g_Group, INVALID, "", 0, 0, 0)
OPTION("-g", g_Joined, Joined, g_Group, INVALID, "", 0, 0, 0)
OPTION("-headerpad_max_install_names", headerpad__max__install__names, Joined, INVALID, INVALID, "", 0, 0, 0)
-OPTION("-idirafter", idirafter, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
+OPTION("-idirafter", idirafter, JoinedOrSeparate, clang_i_Group, INVALID, "", 0, 0, 0)
OPTION("-imacros", imacros, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
OPTION("-image_base", image__base, Separate, INVALID, INVALID, "", 0, 0, 0)
-OPTION("-include", include, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
+OPTION("-include", include, JoinedOrSeparate, clang_i_Group, INVALID, "", 0, 0, 0)
OPTION("-init", init, Separate, INVALID, INVALID, "", 0, 0, 0)
OPTION("-install_name", install__name, Separate, INVALID, INVALID, "", 0, 0, 0)
-OPTION("-iprefix", iprefix, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
-OPTION("-iquote", iquote, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
+OPTION("-iprefix", iprefix, JoinedOrSeparate, clang_i_Group, INVALID, "", 0, 0, 0)
+OPTION("-iquote", iquote, JoinedOrSeparate, clang_i_Group, INVALID, "", 0, 0, 0)
OPTION("-isysroot", isysroot, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
-OPTION("-isystem", isystem, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
-OPTION("-iwithprefixbefore", iwithprefixbefore, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
-OPTION("-iwithprefix", iwithprefix, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
+OPTION("-isystem", isystem, JoinedOrSeparate, clang_i_Group, INVALID, "", 0, 0, 0)
+OPTION("-iwithprefixbefore", iwithprefixbefore, JoinedOrSeparate, clang_i_Group, INVALID, "", 0, 0, 0)
+OPTION("-iwithprefix", iwithprefix, JoinedOrSeparate, clang_i_Group, INVALID, "", 0, 0, 0)
OPTION("-iwithsysroot", iwithsysroot, JoinedOrSeparate, i_Group, INVALID, "", 0, 0, 0)
OPTION("-i", i, Joined, i_Group, INVALID, "", 0, 0, 0)
OPTION("-keep_private_externs", keep__private__externs, Flag, INVALID, INVALID, "", 0, 0, 0)
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index dd3a00e..9e12898 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -287,7 +287,7 @@
Args.AddAllArgs(CmdArgs, options::OPT_D, options::OPT_U);
Args.AddAllArgs(CmdArgs, options::OPT_I_Group, options::OPT_F);
Args.AddLastArg(CmdArgs, options::OPT_P);
- Args.AddAllArgs(CmdArgs, options::OPT_mmacosx_version_min_EQ);
+ Args.AddLastArg(CmdArgs, options::OPT_mmacosx_version_min_EQ);
// Special case debug options to only pass -g to clang. This is
// wrong.
@@ -296,7 +296,8 @@
Args.AddLastArg(CmdArgs, options::OPT_nostdinc);
- // FIXME: Clang isn't going to accept just anything here.
+ Args.AddLastArg(CmdArgs, options::OPT_isysroot);
+
// FIXME: Use iterator.
// Add -i* options, and automatically translate to -include-pth for
@@ -306,7 +307,7 @@
for (ArgList::const_iterator
it = Args.begin(), ie = Args.end(); it != ie; ++it) {
const Arg *A = *it;
- if (!A->getOption().matches(options::OPT_i_Group))
+ if (!A->getOption().matches(options::OPT_clang_i_Group))
continue;
if (A->getOption().matches(options::OPT_include)) {