summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-03-31 20:53:55 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-03-31 20:53:55 +0000
commite521a8994cd24e85f968833209d74ad611d5e4b2 (patch)
tree16cec07205a10cadc05f08a7930f7d7d04e21483 /clang/lib/Driver/Tools.cpp
parent826b6f0f7c5595061050f39041531af13d332e91 (diff)
downloadbcm5719-llvm-e521a8994cd24e85f968833209d74ad611d5e4b2.tar.gz
bcm5719-llvm-e521a8994cd24e85f968833209d74ad611d5e4b2.zip
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. llvm-svn: 68144
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 2f8bc2f4ce2..f2a1f01175b 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -39,6 +39,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
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 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
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) {
OpenPOWER on IntegriCloud