Make sure all weak destructors go in a comdat in the ms abi.

Destructors have a special treatment in getFunctionLinkage. Instead of
duplicating the logic, check the resulting linkage.

llvm-svn: 226361
diff --git a/clang/lib/CodeGen/MicrosoftCXXABI.cpp b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
index c7e66e9..12029bc1 100644
--- a/clang/lib/CodeGen/MicrosoftCXXABI.cpp
+++ b/clang/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -3080,7 +3080,8 @@
     return;
 
   llvm::Function *Fn = CGM.codegenCXXStructor(dtor, dtorType);
-  CGM.maybeSetTrivialComdat(*dtor, *Fn);
+  if (Fn->isWeakForLinker())
+    Fn->setComdat(CGM.getModule().getOrInsertComdat(Fn->getName()));
 }
 
 void MicrosoftCXXABI::emitCXXStructor(const CXXMethodDecl *MD,