[llvm-branch-commits] [llvm-gcc-branch] r95978 - /llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-convert.cpp
Bill Wendling
isanbard at gmail.com
Fri Feb 12 03:01:57 PST 2010
Author: void
Date: Fri Feb 12 05:01:57 2010
New Revision: 95978
URL: http://llvm.org/viewvc/llvm-project?rev=95978&view=rev
Log:
$ svn merge -c 95958 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r95958 into '.':
U gcc/llvm-convert.cpp
$ svn merge -c 95961 https://llvm.org/svn/llvm-project/llvm-gcc-4.2/trunk
--- Merging r95961 into '.':
G gcc/llvm-convert.cpp
Modified:
llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-convert.cpp
Modified: llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-convert.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-convert.cpp?rev=95978&r1=95977&r2=95978&view=diff
==============================================================================
--- llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-convert.cpp (original)
+++ llvm-gcc-4.2/branches/Apple/Hermes/gcc/llvm-convert.cpp Fri Feb 12 05:01:57 2010
@@ -8383,11 +8383,18 @@
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);
+
+ // Literal cstrings in data section needs a label the linker can
+ // see to prevent it from being merged into its previous label.
+ GlobalValue::LinkageTypes Linkage = StringIsConstant
+ ? GlobalValue::PrivateLinkage
+ : GlobalValue::InternalLinkage;
GlobalVariable **SlotP = 0;
-
if (StringIsConstant) {
// Cache the string constants to avoid making obvious duplicate strings that
// have to be folded by the optimizer.
@@ -8399,8 +8406,7 @@
// Create a new string global.
GlobalVariable *GV = new GlobalVariable(*TheModule, Init->getType(),
- StringIsConstant,
- GlobalVariable::PrivateLinkage, Init,
+ StringIsConstant, Linkage, Init,
".str");
GV->setAlignment(get_constant_alignment(exp) / 8);
More information about the llvm-branch-commits
mailing list