summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGCXX.cpp
diff options
context:
space:
mode:
authorAnders Carlsson <andersca@mac.com>2009-10-12 19:45:47 +0000
committerAnders Carlsson <andersca@mac.com>2009-10-12 19:45:47 +0000
commitb61301f353d7a1f7f3c0f3801185163d03528f0e (patch)
treec039d2e68ed3b6456881bff7744f61467d239110 /clang/lib/CodeGen/CGCXX.cpp
parentd7432dfb0a01759e97840b8bbfb686eef2638bbd (diff)
downloadbcm5719-llvm-b61301f353d7a1f7f3c0f3801185163d03528f0e.tar.gz
bcm5719-llvm-b61301f353d7a1f7f3c0f3801185163d03528f0e.zip
Devirtualize calls on temporaries. A().f() for example.
llvm-svn: 83882
Diffstat (limited to 'clang/lib/CodeGen/CGCXX.cpp')
-rw-r--r--clang/lib/CodeGen/CGCXX.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGCXX.cpp b/clang/lib/CodeGen/CGCXX.cpp
index 0744b79d45d..ed7ee4298cc 100644
--- a/clang/lib/CodeGen/CGCXX.cpp
+++ b/clang/lib/CodeGen/CGCXX.cpp
@@ -206,8 +206,14 @@ static bool canDevirtualizeMemberFunctionCalls(const Expr *Base) {
// This is a record decl. We know the type and can devirtualize it.
return VD->getType()->isRecordType();
}
+
+ return false;
}
+ // We can always devirtualize calls on temporaries.
+ if (isa<CXXTemporaryObjectExpr>(Base))
+ return true;
+
// We can't devirtualize the call.
return false;
}
OpenPOWER on IntegriCloud