diff options
author | Daniel Dunbar <daniel@zuster.org> | 2009-03-20 06:14:23 +0000 |
---|---|---|
committer | Daniel Dunbar <daniel@zuster.org> | 2009-03-20 06:14:23 +0000 |
commit | 38dd3d54186cf44ea9d37f463c3f2800ab526b82 (patch) | |
tree | e8803c1540f573bd61a15f03510faeb4f73778d5 /lib/Driver/Arg.cpp | |
parent | 71061bfac28f85bcbdc75a63b8be784ffb67d1e3 (diff) |
Driver: Add Arg::getAsString and use when dumping arguments to
diagnostics.
- This ensures that the whole argument and values are printed,
instead of just the option name.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67366 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/Arg.cpp')
-rw-r--r-- | lib/Driver/Arg.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Driver/Arg.cpp b/lib/Driver/Arg.cpp index eba39dd4f4..c43c9fbe4b 100644 --- a/lib/Driver/Arg.cpp +++ b/lib/Driver/Arg.cpp @@ -50,6 +50,22 @@ void Arg::dump() const { llvm::errs() << ">\n"; } +std::string Arg::getAsString(const ArgList &Args) const { + std::string Res; + llvm::raw_string_ostream OS(Res); + + ArgStringList ASL; + render(Args, ASL); + for (ArgStringList::iterator + it = ASL.begin(), ie = ASL.end(); it != ie; ++it) { + if (it != ASL.begin()) + OS << ' '; + OS << *it; + } + + return OS.str(); +} + void Arg::renderAsInput(const ArgList &Args, ArgStringList &Output) const { if (!getOption().hasNoOptAsInput()) { render(Args, Output); |