aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CGVTables.cpp
diff options
context:
space:
mode:
authorStephen Lin <stephenwlin@gmail.com>2013-06-18 17:00:49 +0000
committerStephen Lin <stephenwlin@gmail.com>2013-06-18 17:00:49 +0000
commita637fb8ccdecd5b0a1171f262b48d62efe9452bd (patch)
treeeb3bc6fd16bde72af833d25a71becd14980e2093 /clang/lib/CodeGen/CGVTables.cpp
parentc724765d528eb6bc22dc12774b98dedf2aba1491 (diff)
downloadllvm-a637fb8ccdecd5b0a1171f262b48d62efe9452bd.zip
llvm-a637fb8ccdecd5b0a1171f262b48d62efe9452bd.tar.gz
llvm-a637fb8ccdecd5b0a1171f262b48d62efe9452bd.tar.bz2
CodeGen: Have 'this'-returning constructors and destructors to take advantage of the new backend 'returned' attribute.
The backend will now use the generic 'returned' attribute to form tail calls where possible, as well as avoid save-restores of 'this' in some cases (specifically the cases that matter for the ARM C++ ABI). This patch also reverts a prior front-end only partial implementation of these optimizations, since it's no longer required. llvm-svn: 184205
Diffstat (limited to 'clang/lib/CodeGen/CGVTables.cpp')
-rw-r--r--clang/lib/CodeGen/CGVTables.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGVTables.cpp b/clang/lib/CodeGen/CGVTables.cpp
index b1072b4..d116877 100644
--- a/clang/lib/CodeGen/CGVTables.cpp
+++ b/clang/lib/CodeGen/CGVTables.cpp
@@ -287,8 +287,9 @@ void CodeGenFunction::GenerateThunk(llvm::Function *Fn,
GlobalDecl GD, const ThunkInfo &Thunk) {
const CXXMethodDecl *MD = cast<CXXMethodDecl>(GD.getDecl());
const FunctionProtoType *FPT = MD->getType()->getAs<FunctionProtoType>();
- QualType ResultType = FPT->getResultType();
QualType ThisType = MD->getThisType(getContext());
+ QualType ResultType =
+ CGM.getCXXABI().HasThisReturn(GD) ? ThisType : FPT->getResultType();
FunctionArgList FunctionArgs;