aboutsummaryrefslogtreecommitdiff
path: root/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
commit76366487694e92509f938164f384bbdfad002f2b (patch)
tree85566c82f4c250a9eadd9aa4d013ce44ea7b8c61 /lib/CodeGen/CGCXX.cpp
parent8e7670de19334eccfe9ac5fc70fa57015b1654c8 (diff)
Devirtualize calls on temporaries. A().f() for example.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@83882 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGCXX.cpp')
-rw-r--r--lib/CodeGen/CGCXX.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/CGCXX.cpp b/lib/CodeGen/CGCXX.cpp
index 0744b79d45..ed7ee4298c 100644
--- a/lib/CodeGen/CGCXX.cpp
+++ b/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;
}