[cfe-commits] r68144 - /cfe/trunk/lib/Driver/Tools.cpp
Daniel Dunbar
daniel at zuster.org
Tue Mar 31 13:53:55 PDT 2009
Author: ddunbar
Date: Tue Mar 31 15:53:55 2009
New Revision: 68144
URL: http://llvm.org/viewvc/llvm-project?rev=68144&view=rev
Log:
Driver: Forward -Wp, and -Xpreprocessor arguments to clang when using
the preprocessor.
- PR3602.
- As is inherent in the blanket forwarding options, this will only
work if clang-cc happens to accept what the user passed. Users by
and large should use driver options to interact with the
preprocessor, if at all possible.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=68144&r1=68143&r2=68144&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar 31 15:53:55 2009
@@ -39,6 +39,8 @@
const char *LinkingOutput) const {
ArgStringList CmdArgs;
+ assert(Inputs.size() == 1 && "Unable to handle multiple inputs.");
+
CmdArgs.push_back("-triple");
const char *TripleStr =
Args.MakeArgString(getToolChain().getTripleString().c_str());
@@ -374,6 +376,16 @@
Args.AddLastArg(CmdArgs, options::OPT_dM);
+ // Add -Wp, and -Xassembler if using the preprocessor.
+
+ // FIXME: There is a very unfortunate problem here, some troubled
+ // souls abuse -Wp, to pass preprocessor options in gcc syntax. To
+ // really support that we would have to parse and then translate
+ // those options. :(
+ if (types::getPreprocessedType(Inputs[0].getType()) != types::TY_INVALID)
+ Args.AddAllArgValues(CmdArgs, options::OPT_Wp_COMMA,
+ options::OPT_Xpreprocessor);
+
Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
if (Output.getType() == types::TY_Dependencies) {
More information about the cfe-commits
mailing list