diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-30 06:36:42 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-30 06:36:42 +0000 |
commit | d67a32252c736d496ed12f173a81303f77b44e1a (patch) | |
tree | 997bf810c264956df04e2bd1ccc91b4bdd52ef07 /clang/lib/Driver/Driver.cpp | |
parent | a01a5638139e6c4d3622db86e3395a81bf601b00 (diff) | |
download | bcm5719-llvm-d67a32252c736d496ed12f173a81303f77b44e1a.tar.gz bcm5719-llvm-d67a32252c736d496ed12f173a81303f77b44e1a.zip |
Driver: Support -M and -MM.
- Not particularly elegant, but my hand is forced by gcc.
Also, tweak -ccc-print-bindings output.
llvm-svn: 68027
Diffstat (limited to 'clang/lib/Driver/Driver.cpp')
-rw-r--r-- | clang/lib/Driver/Driver.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index a5d63e60681..3f1a72d20c6 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -245,8 +245,7 @@ void Driver::PrintVersion(const Compilation &C) const { llvm::errs() << "clang version 1.0 (" << vers << " " << revision << ")" << "\n"; const ToolChain &TC = C.getDefaultToolChain(); - llvm::errs() << "Target: " << TC.getArchName() << '-' - << TC.getPlatform() << '-' << TC.getOS() << '\n'; + llvm::errs() << "Target: " << TC.getTripleString() << '\n'; } bool Driver::HandleImmediateArgs(const Compilation &C) { @@ -379,9 +378,6 @@ void Driver::BuildUniversalActions(const ArgList &Args, if (Archs.size() > 1) { // No recovery needed, the point of this is just to prevent // overwriting the same files. - if (const Arg *A = Args.getLastArg(options::OPT_M_Group)) - Diag(clang::diag::err_drv_invalid_opt_with_multiple_archs) - << A->getAsString(Args); if (const Arg *A = Args.getLastArg(options::OPT_save_temps)) Diag(clang::diag::err_drv_invalid_opt_with_multiple_archs) << A->getAsString(Args); @@ -618,9 +614,15 @@ Action *Driver::ConstructPhaseAction(const ArgList &Args, phases::ID Phase, switch (Phase) { case phases::Link: assert(0 && "link action invalid here."); case phases::Preprocess: { - types::ID OutputTy = types::getPreprocessedType(Input->getType()); - assert(OutputTy != types::TY_INVALID && - "Cannot preprocess this input type!"); + types::ID OutputTy; + // -{M, MM} alter the output type. + if (Args.hasArg(options::OPT_M) || Args.hasArg(options::OPT_MM)) { + OutputTy = types::TY_Dependencies; + } else { + OutputTy = types::getPreprocessedType(Input->getType()); + assert(OutputTy != types::TY_INVALID && + "Cannot preprocess this input type!"); + } return new PreprocessJobAction(Input, OutputTy); } case phases::Precompile: @@ -848,7 +850,8 @@ void Driver::BuildJobsForAction(Compilation &C, } if (CCCPrintBindings) { - llvm::errs() << "bind - \"" << T.getName() << "\", inputs: ["; + llvm::errs() << "# \"" << T.getToolChain().getTripleString() << '"' + << " - \"" << T.getName() << "\", inputs: ["; for (unsigned i = 0, e = InputInfos.size(); i != e; ++i) { llvm::errs() << InputInfos[i].getAsString(); if (i + 1 != e) |