aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-03-14 16:13:32 +0000
committerDouglas Gregor <dgregor@apple.com>2011-03-14 16:13:32 +0000
commit069a6da34a86c97ffe78c379da246fc8116daaff (patch)
tree2f97edf22cdd3eeb6bec5b915396e06578c0af16
parenta4fdbfad150ae37bddaa4094d3925a27a1a1cf3f (diff)
-fwritable-strings should silence warnings about the deprecated string
-literal to char* conversion. Make it so. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@127586 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Sema/SemaExprCXX.cpp3
-rw-r--r--test/SemaCXX/writable-strings-deprecated.cpp1
2 files changed, 3 insertions, 1 deletions
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index ea93449d7b..5701835c1a 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -2273,7 +2273,8 @@ Sema::PerformImplicitConversion(Expr *&From, QualType ToType,
ImpCastExprToType(From, ToType.getNonLValueExprType(Context),
CK_NoOp, VK);
- if (SCS.DeprecatedStringLiteralToCharPtr)
+ if (SCS.DeprecatedStringLiteralToCharPtr &&
+ !getLangOptions().WritableStrings)
Diag(From->getLocStart(), diag::warn_deprecated_string_literal_conversion)
<< ToType.getNonReferenceType();
diff --git a/test/SemaCXX/writable-strings-deprecated.cpp b/test/SemaCXX/writable-strings-deprecated.cpp
index c89c882564..66b5994798 100644
--- a/test/SemaCXX/writable-strings-deprecated.cpp
+++ b/test/SemaCXX/writable-strings-deprecated.cpp
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Wno-deprecated-writable-strings -verify %s
+// RUN: %clang_cc1 -fsyntax-only -fwritable-strings -verify %s
// rdar://8827606
char *fun(void)