summaryrefslogtreecommitdiffstats
path: root/lib/Driver
diff options
context:
space:
mode:
authorChad Rosier <mcrosier@apple.com>2012-03-13 20:09:56 +0000
committerChad Rosier <mcrosier@apple.com>2012-03-13 20:09:56 +0000
commit2dec85b21822f950bf6035640c496ad835e11728 (patch)
tree6feb366bf192bf25d6a4ca2244e7e5d318722bc6 /lib/Driver
parentb990d039c7e01ad0055dcbd1e13a691813397b96 (diff)
[driver] Parse diagnostic args in the driver.
Previously, only diagnostics thrown by the cc1 process were actually honoring the diagnostic options given on the command line, like -Werror. Reuse the existing code in Frontend currently used for cc1, adjusting it to not interpret -Wl, linker flags as warnings. Also fix a faulty test exposed by this change. It wasn't actually testing anything, and was giving this warning: clang-3: warning: argument unused during compilation: '-verify' Which -Werror didn't turn into an error because it was output by the driver, not the cc1 process, and diagnostic options weren't parsed by the driver. And you couldn't see the warning when running the test suite. Fixes PR12181. Patch by Dylan Noblesmith <nobled@dreamwidth.org>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@152660 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver')
-rw-r--r--lib/Driver/ArgList.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/Driver/ArgList.cpp b/lib/Driver/ArgList.cpp
index d26da25b3e..55a0ddfd27 100644
--- a/lib/Driver/ArgList.cpp
+++ b/lib/Driver/ArgList.cpp
@@ -154,13 +154,15 @@ StringRef ArgList::getLastArgValue(OptSpecifier Id,
}
int ArgList::getLastArgIntValue(OptSpecifier Id, int Default,
- clang::DiagnosticsEngine &Diags) const {
+ clang::DiagnosticsEngine *Diags) const {
int Res = Default;
if (Arg *A = getLastArg(Id)) {
- if (StringRef(A->getValue(*this)).getAsInteger(10, Res))
- Diags.Report(diag::err_drv_invalid_int_value)
- << A->getAsString(*this) << A->getValue(*this);
+ if (StringRef(A->getValue(*this)).getAsInteger(10, Res)) {
+ if (Diags)
+ Diags->Report(diag::err_drv_invalid_int_value)
+ << A->getAsString(*this) << A->getValue(*this);
+ }
}
return Res;