diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2010-09-23 23:49:25 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2010-09-23 23:49:25 +0000 |
commit | 280ec9d23cf16f50fd173bc87da7d2101446bcdd (patch) | |
tree | ae8d2194e65bec9447b6909af2a814337040f935 /lib/Driver/Driver.cpp | |
parent | e3365aa452673f7ea3244bb6638551f13ab7570d (diff) |
Make -M/-MM behave like in gcc; use -MF first then -o else use stdout.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@114712 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Driver.cpp')
-rw-r--r-- | lib/Driver/Driver.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/Driver/Driver.cpp b/lib/Driver/Driver.cpp index 0555342bc8..84a33a5f77 100644 --- a/lib/Driver/Driver.cpp +++ b/lib/Driver/Driver.cpp @@ -1151,16 +1151,22 @@ const char *Driver::GetNamedOutputPath(Compilation &C, const char *BaseInput, bool AtTopLevel) const { llvm::PrettyStackTraceString CrashInfo("Computing output path"); + + // Default to writing to stdout. + if (AtTopLevel && isa<PreprocessJobAction>(JA)) { + if (Arg *DepOutput = C.getArgs().getLastArg(options::OPT_MF)) + return C.addResultFile(DepOutput->getValue(C.getArgs())); + if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o)) + return C.addResultFile(FinalOutput->getValue(C.getArgs())); + return "-"; + } + // Output to a user requested destination? if (AtTopLevel && !isa<DsymutilJobAction>(JA)) { if (Arg *FinalOutput = C.getArgs().getLastArg(options::OPT_o)) return C.addResultFile(FinalOutput->getValue(C.getArgs())); } - // Default to writing to stdout? - if (AtTopLevel && isa<PreprocessJobAction>(JA)) - return "-"; - // Output to a temporary file? if (!AtTopLevel && !C.getArgs().hasArg(options::OPT_save_temps)) { std::string TmpName = |