summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2018-03-02 01:29:51 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2018-03-02 01:29:51 +0000
commit796d4a885d9ae896d92c838c5d49adc7ef645e62 (patch)
tree7a47aa4f8797443afa7d80fd6ef87631d5078a1d /clang/lib/CodeGen/CodeGenModule.cpp
parent5a9e834eac3e88d3050c7f6d115fede346abd32d (diff)
downloadbcm5719-llvm-796d4a885d9ae896d92c838c5d49adc7ef645e62.tar.gz
bcm5719-llvm-796d4a885d9ae896d92c838c5d49adc7ef645e62.zip
Always set dso_local in CodeGenModule::setDSOLocal.
This shouldn't change any results for now, but is more consistent with how we set dllimport/dllexport and will make future changes easier. Since clang produces IR as it parses, it can find out mid file that something is dllimport. When that happens we have to drop dso_local. This is not a problem right now because CodeGenModule::setDSOLocal is called from relatively few places at the moment. llvm-svn: 326527
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 389f586443c..de3810554f9 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -716,6 +716,12 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV,
static bool shouldAssumeDSOLocal(const CodeGenModule &CGM,
llvm::GlobalValue *GV) {
+ if (GV->hasLocalLinkage())
+ return true;
+
+ if (!GV->hasDefaultVisibility() && !GV->hasExternalWeakLinkage())
+ return true;
+
// DLLImport explicitly marks the GV as external.
if (GV->hasDLLImportStorageClass())
return false;
@@ -773,8 +779,7 @@ static bool shouldAssumeDSOLocal(const CodeGenModule &CGM,
}
void CodeGenModule::setDSOLocal(llvm::GlobalValue *GV) const {
- if (shouldAssumeDSOLocal(*this, GV))
- GV->setDSOLocal(true);
+ GV->setDSOLocal(shouldAssumeDSOLocal(*this, GV));
}
void CodeGenModule::setDLLImportDLLExport(llvm::GlobalValue *GV,
OpenPOWER on IntegriCloud