diff options
author | Akira Hatanaka <ahatanaka@apple.com> | 2015-10-08 20:26:34 +0000 |
---|---|---|
committer | Akira Hatanaka <ahatanaka@apple.com> | 2015-10-08 20:26:34 +0000 |
commit | aec6b2c20e4850f2309042e46dec63e46b383fbd (patch) | |
tree | f10152e47c1fc6a470865f0d11f2a0ab8b032cac /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | ab2241f1b83aaa55944a257e5271bfc3d8a14715 (diff) | |
download | llvm-aec6b2c20e4850f2309042e46dec63e46b383fbd.zip llvm-aec6b2c20e4850f2309042e46dec63e46b383fbd.tar.gz llvm-aec6b2c20e4850f2309042e46dec63e46b383fbd.tar.bz2 |
[CodeGen] [CodeGen] Attach function attributes to functions created in
CGBlocks.cpp.
This commit fixes a bug in clang's code-gen where it creates the
following functions but doesn't attach function attributes to them:
__copy_helper_block_
__destroy_helper_block_
__Block_byref_object_copy_
__Block_byref_object_dispose_
rdar://problem/20828324
Differential Revision: http://reviews.llvm.org/D13525
llvm-svn: 249735
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index dd8e76e..8c5491b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -867,12 +867,12 @@ void CodeGenModule::SetLLVMFunctionAttributesForDefinition(const Decl *D, void CodeGenModule::SetCommonAttributes(const Decl *D, llvm::GlobalValue *GV) { - if (const auto *ND = dyn_cast<NamedDecl>(D)) + if (const auto *ND = dyn_cast_or_null<NamedDecl>(D)) setGlobalVisibility(GV, ND); else GV->setVisibility(llvm::GlobalValue::DefaultVisibility); - if (D->hasAttr<UsedAttr>()) + if (D && D->hasAttr<UsedAttr>()) addUsedGlobal(GV); } @@ -890,8 +890,9 @@ void CodeGenModule::setNonAliasAttributes(const Decl *D, llvm::GlobalObject *GO) { SetCommonAttributes(D, GO); - if (const SectionAttr *SA = D->getAttr<SectionAttr>()) - GO->setSection(SA->getName()); + if (D) + if (const SectionAttr *SA = D->getAttr<SectionAttr>()) + GO->setSection(SA->getName()); getTargetCodeGenInfo().setTargetAttributes(D, GO, *this); } |