From c33dec36642bb47c2451f3d33f8cf75f3c99f57c Mon Sep 17 00:00:00 2001 From: John McCall Date: Mon, 15 Mar 2010 10:54:44 +0000 Subject: Add support for -Wwrite-strings. Patch by Mike M! Fixes PR 4804. llvm-svn: 98541 --- clang/lib/Sema/SemaExprObjC.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'clang/lib/Sema/SemaExprObjC.cpp') diff --git a/clang/lib/Sema/SemaExprObjC.cpp b/clang/lib/Sema/SemaExprObjC.cpp index c60455d8456..c98ba435c78 100644 --- a/clang/lib/Sema/SemaExprObjC.cpp +++ b/clang/lib/Sema/SemaExprObjC.cpp @@ -106,7 +106,7 @@ Expr *Sema::BuildObjCEncodeExpression(SourceLocation AtLoc, // which is an array type. StrTy = Context.CharTy; // A C++ string literal has a const-qualified element type (C++ 2.13.4p1). - if (getLangOptions().CPlusPlus) + if (getLangOptions().CPlusPlus || getLangOptions().ConstStrings) StrTy.addConst(); StrTy = Context.getConstantArrayType(StrTy, llvm::APInt(32, Str.size()+1), ArrayType::Normal, 0); -- cgit v1.2.3