From 374c2bb37e7bbc4585cd6b7cd525e2ba09d8d497 Mon Sep 17 00:00:00 2001 From: Joerg Sonnenberger Date: Fri, 22 Nov 2013 21:34:35 +0000 Subject: Adjust r194296 to not apply the alias replacement for externally available always-inline functions. This breaks libc++'s locale implementation. Code generation for this case should be fixed, but this is a stop gap fix for clang 3.4. llvm-svn: 195501 --- clang/lib/CodeGen/CGCXX.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'clang/lib/CodeGen/CGCXX.cpp') diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp index 22baa654084..cfb2d6291b8 100644 --- a/clang/lib/CodeGen/CGCXX.cpp +++ b/clang/lib/CodeGen/CGCXX.cpp @@ -140,7 +140,14 @@ bool CodeGenModule::TryEmitDefinitionAsAlias(GlobalDecl AliasDecl, // Instead of creating as alias to a linkonce_odr, replace all of the uses // of the aliassee. - if (llvm::GlobalValue::isDiscardableIfUnused(Linkage)) { + if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) && + (TargetLinkage != llvm::GlobalValue::AvailableExternallyLinkage || + !TargetDecl.getDecl()->hasAttr())) { + // FIXME: An extern template instanciation will create functions with + // linkage "AvailableExternally". In libc++, some classes also define + // members with attribute "AlwaysInline" and expect no reference to + // be generated. It is desirable to reenable this optimisation after + // corresponding LLVM changes. Replacements[MangledName] = Aliasee; return false; } -- cgit v1.2.3