diff options
author | John McCall <rjmccall@apple.com> | 2011-02-19 02:53:41 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2011-02-19 02:53:41 +0000 |
commit | 837796754391377198973bac26fb2f229a4665f6 (patch) | |
tree | d247c984367931e2828fd281cfefc385da24029d /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 85e8b8149243052c721c97ad97ebda82867071a4 (diff) | |
download | bcm5719-llvm-837796754391377198973bac26fb2f229a4665f6.tar.gz bcm5719-llvm-837796754391377198973bac26fb2f229a4665f6.zip |
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.
llvm-svn: 126016
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 5a45df24fe8..9e5d7cf1127 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/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<DLLImportAttr>()) GV->setLinkage(llvm::GlobalValue::DLLImportLinkage); |