From 15e310a3b970b64a84cb30f0005bc396b4d978cb Mon Sep 17 00:00:00 2001 From: John McCall Date: Sat, 19 Feb 2011 02:53:41 +0000 Subject: Warn about code that uses variables and functions with internal linkage without defining them. This should be an error, but I'm paranoid about "uses" that end up not actually requiring a definition. I'll revisit later. Also, teach IR generation to not set internal linkage on variable declarations, just for safety's sake. Doing so produces an invalid module if the variable is not ultimately defined. Also, fix several places in the test suite where we were using internal functions without definitions. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126016 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/CodeGen/CodeGenModule.cpp') diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index 5a45df24fe..9e5d7cf112 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -983,7 +983,7 @@ CodeGenModule::GetOrCreateLLVMGlobal(llvm::StringRef MangledName, // Set linkage and visibility in case we never see a definition. NamedDecl::LinkageInfo LV = D->getLinkageAndVisibility(); if (LV.linkage() != ExternalLinkage) { - GV->setLinkage(llvm::GlobalValue::InternalLinkage); + // Don't set internal linkage on declarations. } else { if (D->hasAttr()) GV->setLinkage(llvm::GlobalValue::DLLImportLinkage); -- cgit v1.2.3-70-g09d2