[llvm-commits] [llvm-gcc-4.2] r95958 - /llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Evan Cheng evan.cheng at apple.com
Thu Feb 11 18:01:14 PST 2010


Author: evancheng
Date: Thu Feb 11 20:01:14 2010
New Revision: 95958

URL: http://llvm.org/viewvc/llvm-project?rev=95958&view=rev
Log:
Observe -fconstant-cfstring. When it's set, ignore -fwritable-strings on CFString.
This is partial fix for rdar://7634471.

Modified:
    llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp

Modified: llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp?rev=95958&r1=95957&r2=95958&view=diff

==============================================================================
--- llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/trunk/gcc/llvm-convert.cpp Thu Feb 11 20:01:14 2010
@@ -8383,11 +8383,12 @@
 Constant *TreeConstantToLLVM::EmitLV_STRING_CST(tree exp) {
   Constant *Init = TreeConstantToLLVM::ConvertSTRING_CST(exp);
 
-  // Support -fwritable-strings.
-  bool StringIsConstant = !flag_writable_strings;
+  // Support -fwritable-strings. However, ignores it if exp is a CFString and
+  // -fconstant-cfstring (default) is set.
+  bool StringIsConstant = !flag_writable_strings ||
+    darwin_constant_cfstring_p(exp);
 
   GlobalVariable **SlotP = 0;
-
   if (StringIsConstant) {
     // Cache the string constants to avoid making obvious duplicate strings that
     // have to be folded by the optimizer.





More information about the llvm-commits mailing list