From b944197840869869bdaff1fbb486cbfaddefbeac Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Sun, 23 Mar 2014 17:47:16 +0000 Subject: MS ABI: Eliminate Duplicate Strings COFF doesn't have mergeable sections so LLVM/clang's normal tactics for string deduplication will not have any effect. To remedy this we place each string inside it's own section and mark the section as IMAGE_COMDAT_SELECT_ANY. However, we can only do this if the string has an external name that we can generate from it's contents. To be compatible with MSVC, we must use their scheme. Otherwise identical strings in translation units from clang may not be deduplicated with translation units in MSVC. This fixes PR18248. N.B. We will not attempt to do anything with a string literal which is not of type 'char' or 'wchar_t' because their compiler does not support unicode string literals as of this date. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204562 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/CodeGen/CodeGenModule.h') diff --git a/lib/CodeGen/CodeGenModule.h b/lib/CodeGen/CodeGenModule.h index 4bd8b7a3de..7694eed1a1 100644 --- a/lib/CodeGen/CodeGenModule.h +++ b/lib/CodeGen/CodeGenModule.h @@ -319,7 +319,10 @@ class CodeGenModule : public CodeGenTypeCache { llvm::StringMap AnnotationStrings; llvm::StringMap CFConstantStringMap; - llvm::StringMap ConstantStringMap; + + llvm::StringMap Constant1ByteStringMap; + llvm::StringMap Constant2ByteStringMap; + llvm::StringMap Constant4ByteStringMap; llvm::DenseMap StaticLocalDeclMap; llvm::DenseMap StaticLocalDeclGuardMap; llvm::DenseMap MaterializedGlobalTemporaryMap; -- cgit v1.2.3