From 2ac9fc2ad64e16127df8c60caeea2edfe9a400a2 Mon Sep 17 00:00:00 2001 From: Daniel Dunbar Date: Tue, 7 Apr 2009 21:42:00 +0000 Subject: [PATCH] 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 --- include/clang/Driver/Options.def | 15 ++++++++------- lib/Driver/Tools.cpp | 7 ++++--- 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, Group, INVALID, INVALID, "", 0, 0, 0) OPTION("", clang_f_Group, Group, f_Group, INVALID, "", 0, 0, 0) OPTION("", g_Group, Group, INVALID, INVALID, "", 0, 0, 0) OPTION("", i_Group, Group, INVALID, INVALID, "", 0, 0, 0) +OPTION("", clang_i_Group, Group, i_Group, INVALID, "", 0, 0, 0) OPTION("", m_Group, Group, INVALID, INVALID, "", 0, 0, 0) OPTION("", 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)) { -- 2.40.0