aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-07 21:42:00 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-07 21:42:00 +0000
commit2ac9fc2ad64e16127df8c60caeea2edfe9a400a2 (patch)
treeecdd412d7cca95198a75bb114b068b9541a0a317
parentc8bafd7242763b7029a7bed898690ea44a59ae4a (diff)
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
-rw-r--r--include/clang/Driver/Options.def15
-rw-r--r--lib/Driver/Tools.cpp7
2 files changed, 12 insertions, 10 deletions
diff --git a/include/clang/Driver/Options.def b/include/clang/Driver/Options.def
index bfa5a664ee..9e86a24e38 100644
--- a/include/clang/Driver/Options.def
+++ b/include/clang/Driver/Options.def
@@ -108,6 +108,7 @@ OPTION("<f group>", f_Group, Group, INVALID, INVALID, "", 0, 0, 0)
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("-gused", gused, Joined, g_Group, INVALID, "", 0, 0, 0)
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 dd3a00ecb3..9e128984bf 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -287,7 +287,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
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 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
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 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
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)) {