diff options
author | Stephen Lin <stephenwlin@gmail.com> | 2013-06-30 20:40:16 +0000 |
---|---|---|
committer | Stephen Lin <stephenwlin@gmail.com> | 2013-06-30 20:40:16 +0000 |
commit | 9dc6eef755c756db67552eccd5f2e910d8d504b3 (patch) | |
tree | de664e43946e8c99d3bdf353895f6d47fa69d364 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 2e551adcd98dc5b9a3e1ceabd07dd7d0be94c4b7 (diff) | |
download | bcm5719-llvm-9dc6eef755c756db67552eccd5f2e910d8d504b3.tar.gz bcm5719-llvm-9dc6eef755c756db67552eccd5f2e910d8d504b3.zip |
Restore r184205 and associated commits (after commit of r185290)
This allows clang to use the backend parameter attribute 'returned' when generating 'this'-returning constructors and destructors in ARM and MSVC C++ ABIs.
llvm-svn: 185291
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index efff4b118d5..3298d5a0899 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -722,6 +722,14 @@ void CodeGenModule::SetFunctionAttributes(GlobalDecl GD, if (!IsIncompleteFunction) SetLLVMFunctionAttributes(FD, getTypes().arrangeGlobalDeclaration(GD), F); + if (getCXXABI().HasThisReturn(GD)) { + assert(!F->arg_empty() && + F->arg_begin()->getType() + ->canLosslesslyBitCastTo(F->getReturnType()) && + "unexpected this return"); + F->addAttribute(1, llvm::Attribute::Returned); + } + // Only a few attributes are set on declarations; these may later be // overridden by a definition. |