[cfe-commits] r127586 - in /cfe/trunk: lib/Sema/SemaExprCXX.cpp test/SemaCXX/writable-strings-deprecated.cpp

Douglas Gregor dgregor at apple.com
Mon Mar 14 09:13:32 PDT 2011


Author: dgregor
Date: Mon Mar 14 11:13:32 2011
New Revision: 127586

URL: http://llvm.org/viewvc/llvm-project?rev=127586&view=rev
Log:
-fwritable-strings should silence warnings about the deprecated string
-literal to char* conversion. Make it so.

Modified:
    cfe/trunk/lib/Sema/SemaExprCXX.cpp
    cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp

Modified: cfe/trunk/lib/Sema/SemaExprCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaExprCXX.cpp?rev=127586&r1=127585&r2=127586&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaExprCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaExprCXX.cpp Mon Mar 14 11:13:32 2011
@@ -2273,7 +2273,8 @@
     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();
 

Modified: cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp?rev=127586&r1=127585&r2=127586&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp (original)
+++ cfe/trunk/test/SemaCXX/writable-strings-deprecated.cpp Mon Mar 14 11:13:32 2011
@@ -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)





More information about the cfe-commits mailing list