summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2018-03-14 18:14:46 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2018-03-14 18:14:46 +0000
commit3f727a8f3a5e1c2e811e1da5fdcd654015c89815 (patch)
tree731f5ab2bf68f14fbf4ab5b9607439ffcc7dfd97 /clang/lib/CodeGen
parente2cc92ce284719b80deb46511ca10682adeca03e (diff)
downloadbcm5719-llvm-3f727a8f3a5e1c2e811e1da5fdcd654015c89815.tar.gz
bcm5719-llvm-3f727a8f3a5e1c2e811e1da5fdcd654015c89815.zip
Set dso_local on external rtti GVs.
In this particular case it would be possible to just add an else with CGM.setDSOLocal(GV), but it seems better to have as many callers as possible just call setGVProperties so that we can centralize the logic there. This patch then makes setGVProperties able to handle null Decls. llvm-svn: 327543
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp5
-rw-r--r--clang/lib/CodeGen/ItaniumCXXABI.cpp6
2 files changed, 5 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index de3810554f9..e75780a0a93 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -707,7 +707,8 @@ void CodeGenModule::setGlobalVisibility(llvm::GlobalValue *GV,
GV->setVisibility(llvm::GlobalValue::DefaultVisibility);
return;
}
-
+ if (!D)
+ return;
// Set visibility for definitions.
LinkageInfo LV = D->getLinkageAndVisibility();
if (LV.isVisibilityExplicit() || !GV->isDeclarationForLinker())
@@ -797,7 +798,7 @@ void CodeGenModule::setDLLImportDLLExport(llvm::GlobalValue *GV,
void CodeGenModule::setDLLImportDLLExport(llvm::GlobalValue *GV,
const NamedDecl *D) const {
- if (D->isExternallyVisible()) {
+ if (D && D->isExternallyVisible()) {
if (D->hasAttr<DLLImportAttr>())
GV->setDLLStorageClass(llvm::GlobalVariable::DLLImportStorageClass);
else if (D->hasAttr<DLLExportAttr>() && !GV->isDeclarationForLinker())
diff --git a/clang/lib/CodeGen/ItaniumCXXABI.cpp b/clang/lib/CodeGen/ItaniumCXXABI.cpp
index 21223ea23dd..3862b58a49f 100644
--- a/clang/lib/CodeGen/ItaniumCXXABI.cpp
+++ b/clang/lib/CodeGen/ItaniumCXXABI.cpp
@@ -2616,10 +2616,8 @@ ItaniumRTTIBuilder::GetAddrOfExternalRTTIDescriptor(QualType Ty) {
/*Constant=*/true,
llvm::GlobalValue::ExternalLinkage, nullptr,
Name);
- if (const RecordType *RecordTy = dyn_cast<RecordType>(Ty)) {
- const CXXRecordDecl *RD = cast<CXXRecordDecl>(RecordTy->getDecl());
- CGM.setGVProperties(GV, RD);
- }
+ const CXXRecordDecl *RD = Ty->getAsCXXRecordDecl();
+ CGM.setGVProperties(GV, RD);
}
return llvm::ConstantExpr::getBitCast(GV, CGM.Int8PtrTy);
OpenPOWER on IntegriCloud