Fix -MD with no -MT when -o is specified (and fix test case).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@68042 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Driver/Tools.cpp b/lib/Driver/Tools.cpp
index 3e8ccb3..e315a2f 100644
--- a/lib/Driver/Tools.cpp
+++ b/lib/Driver/Tools.cpp
@@ -246,7 +246,7 @@
// when we are only generating a dependency file.
Arg *OutputOpt = Args.getLastArg(options::OPT_o);
if (OutputOpt && Output.getType() != types::TY_Dependencies) {
- DepTarget = A->getValue(Args);
+ DepTarget = OutputOpt->getValue(Args);
} else {
// Otherwise derive from the base input.
//