Commit 0fb856a3 authored by Reid Kleckner's avatar Reid Kleckner
Browse files

Merge r244266 to the 3.7 release branch

It's actually probably a no-op, since the 3.7 branch will not generate
available externally vtables.

llvm-svn: 245387
parent b7a003e0
Loading
Loading
Loading
Loading
+14 −4
Original line number Diff line number Diff line
@@ -2420,10 +2420,13 @@ static bool ShouldUseExternalRTTIDescriptor(CodeGenModule &CGM,

    // FIXME: this may need to be reconsidered if the key function
    // changes.
    // N.B. We must always emit the RTTI data ourselves if there exists a key
    // function.
    bool IsDLLImport = RD->hasAttr<DLLImportAttr>();
    if (CGM.getVTables().isVTableExternal(RD))
      return true;
      return IsDLLImport ? false : true;

    if (RD->hasAttr<DLLImportAttr>())
    if (IsDLLImport)
      return true;
  }

@@ -2653,8 +2656,15 @@ static llvm::GlobalVariable::LinkageTypes getTypeInfoLinkage(CodeGenModule &CGM,
      const CXXRecordDecl *RD = cast<CXXRecordDecl>(Record->getDecl());
      if (RD->hasAttr<WeakAttr>())
        return llvm::GlobalValue::WeakODRLinkage;
      if (RD->isDynamicClass())
        return CGM.getVTableLinkage(RD);
      if (RD->isDynamicClass()) {
        llvm::GlobalValue::LinkageTypes LT = CGM.getVTableLinkage(RD);
        // MinGW won't export the RTTI information when there is a key function.
        // Make sure we emit our own copy instead of attempting to dllimport it.
        if (RD->hasAttr<DLLImportAttr>() &&
            llvm::GlobalValue::isAvailableExternallyLinkage(LT))
          LT = llvm::GlobalValue::LinkOnceODRLinkage;
        return LT;
      }
    }

    return llvm::GlobalValue::LinkOnceODRLinkage;
+5 −0
Original line number Diff line number Diff line
@@ -15,3 +15,8 @@ struct __declspec(dllimport) S {

struct U : S {
} u;

struct __declspec(dllimport) V {
  virtual void f();
} v;
// GNU-DAG: @_ZTV1V = external dllimport