[PATCH] D24682: [PR30341] Alias must point to a definition

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 28 10:56:15 PDT 2016

rsmith added inline comments.

Comment at: clang/lib/CodeGen/CGCXX.cpp:170
@@ -170,3 +169,3 @@
   // If we have a weak, non-discardable alias (weak, weak_odr), like an extern
   // template instantiation or a dllexported class, avoid forming it on COFF.
We can now only reach this code for the case where `TargetLinkage != llvm::GlobalValue::AvailableExternallyLinkage`. Substituting `true` for that expression here gives

  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) &&
      (true || !TargetDecl.getDecl()->hasAttr<AlwaysInlineAttr>())) {

which simplifies to

  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage)) {


  if (llvm::GlobalValue::isDiscardableIfUnused(Linkage) &&
      !TargetDecl.getDecl()->hasAttr<AlwaysInlineAttr>()) {

We used to enter this case for a function that is discardable if unused, not available externally, and always inline (that is, a normal inline+always_inline function). With this change, we don't do so any more.


More information about the cfe-commits mailing list