diff options
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 5 |
1 files changed, 3 insertions, 2 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()) |