summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver/Tools.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2013-11-05 21:43:54 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2013-11-05 21:43:54 +0000
commit0df9e16cc7a93cbe2f0cb3cb488f89e87c3fe604 (patch)
tree46408149bed6bc4c151026c946a96360a4fe0810 /clang/lib/Driver/Tools.cpp
parent0eb87390adef00298a1e296da456305a4bb2cab2 (diff)
downloadbcm5719-llvm-0df9e16cc7a93cbe2f0cb3cb488f89e87c3fe604.tar.gz
bcm5719-llvm-0df9e16cc7a93cbe2f0cb3cb488f89e87c3fe604.zip
With this patch -Wwrite-strings is still implemented with the terrible
hack of passing -fconst-strings to -cc1, but at least the driver uses the regular warning checking code path. Since we don't support a warning that is DefaultIgnore in one language but not in another, this patch creates a dummy C only warning in the same group as the existing one to get the desired effect. llvm-svn: 194097
Diffstat (limited to 'clang/lib/Driver/Tools.cpp')
-rw-r--r--clang/lib/Driver/Tools.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/clang/lib/Driver/Tools.cpp b/clang/lib/Driver/Tools.cpp
index 0aac191bac0..5ac2268ee3e 100644
--- a/clang/lib/Driver/Tools.cpp
+++ b/clang/lib/Driver/Tools.cpp
@@ -21,6 +21,7 @@
#include "clang/Driver/SanitizerArgs.h"
#include "clang/Driver/ToolChain.h"
#include "clang/Driver/Util.h"
+#include "clang/Sema/SemaDiagnostic.h"
#include "llvm/ADT/SmallString.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringSwitch.h"
@@ -2790,13 +2791,9 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
// behavior for now. FIXME: Directly diagnose uses of a string literal as
// a non-const char* in C, rather than using this crude hack.
if (!types::isCXX(InputType)) {
- // FIXME: This should behave just like a warning flag, and thus should also
- // respect -Weverything, -Wno-everything, -Werror=write-strings, and so on.
- Arg *WriteStrings =
- Args.getLastArg(options::OPT_Wwrite_strings,
- options::OPT_Wno_write_strings, options::OPT_w);
- if (WriteStrings &&
- WriteStrings->getOption().matches(options::OPT_Wwrite_strings))
+ DiagnosticsEngine::Level DiagLevel = D.getDiags().getDiagnosticLevel(
+ diag::warn_deprecated_string_literal_conversion_c, SourceLocation());
+ if (DiagLevel > DiagnosticsEngine::Ignored)
CmdArgs.push_back("-fconst-strings");
}
OpenPOWER on IntegriCloud