if a decl is both 'static' and weak or static and inline, its linkage
type should be internal, not weak/linkonce.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50611 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp
index 1b94c59..bacb610 100644
--- a/lib/CodeGen/CodeGenFunction.cpp
+++ b/lib/CodeGen/CodeGenFunction.cpp
@@ -159,14 +159,14 @@
   
   // TODO: Set up linkage and many other things.  Note, this is a simple 
   // approximation of what we really want.
-  if (FD->getAttr<DLLImportAttr>())
+  if (FD->getStorageClass() == FunctionDecl::Static)
+    CurFn->setLinkage(llvm::Function::InternalLinkage);
+  else if (FD->getAttr<DLLImportAttr>())
     CurFn->setLinkage(llvm::Function::DLLImportLinkage);
   else if (FD->getAttr<DLLExportAttr>())
     CurFn->setLinkage(llvm::Function::DLLExportLinkage);
   else if (FD->getAttr<WeakAttr>() || FD->isInline())
     CurFn->setLinkage(llvm::Function::WeakLinkage);
-  else if (FD->getStorageClass() == FunctionDecl::Static)
-    CurFn->setLinkage(llvm::Function::InternalLinkage);
 
   if (FD->getAttr<FastCallAttr>())
     CurFn->setCallingConv(llvm::CallingConv::Fast);