Move logic for selection -fmessage-length= to driver.

llvm-svn: 86013
This commit is contained in:
Daniel Dunbar 2009-11-04 06:24:47 +00:00
parent 1c7577c9bd
commit 2c9784769a
2 changed files with 12 additions and 7 deletions

View File

@ -26,6 +26,7 @@
#include "llvm/ADT/Twine.h"
#include "llvm/Support/Format.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/System/Process.h"
#include "InputInfo.h"
#include "ToolChains.h"
@ -839,13 +840,23 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(A->getValue(Args));
}
// Pass -fmessage-length=.
if (Arg *A = Args.getLastArg(options::OPT_fmessage_length_EQ)) {
A->render(Args, CmdArgs);
} else {
// If -fmessage-length=N was not specified, determine whether this is a
// terminal and, if so, implicitly define -fmessage-length appropriately.
unsigned N = llvm::sys::Process::StandardErrColumns();
CmdArgs.push_back("-fmessage-length");
CmdArgs.push_back(Args.MakeArgString(llvm::Twine(N)));
}
// Forward -f options which we can pass directly.
Args.AddLastArg(CmdArgs, options::OPT_femit_all_decls);
Args.AddLastArg(CmdArgs, options::OPT_ffreestanding);
Args.AddLastArg(CmdArgs, options::OPT_fheinous_gnu_extensions);
Args.AddLastArg(CmdArgs, options::OPT_fgnu_runtime);
Args.AddLastArg(CmdArgs, options::OPT_flax_vector_conversions);
Args.AddLastArg(CmdArgs, options::OPT_fmessage_length_EQ);
Args.AddLastArg(CmdArgs, options::OPT_fms_extensions);
Args.AddLastArg(CmdArgs, options::OPT_fnext_runtime);
Args.AddLastArg(CmdArgs, options::OPT_fno_caret_diagnostics);

View File

@ -2153,12 +2153,6 @@ int main(int argc, char **argv) {
if (InputFilenames.empty())
InputFilenames.push_back("-");
// If -fmessage-length=N was not specified, determine whether this
// is a terminal and, if so, implicitly define -fmessage-length
// appropriately.
if (MessageLength.getNumOccurrences() == 0)
MessageLength.setValue(llvm::sys::Process::StandardErrColumns());
// Initialize the diagnostic options.
DiagOpts.ShowColumn = !NoShowColumn;
DiagOpts.ShowLocation = !NoShowLocation;