Support returning values of arbitrary class type.

This restriction prevents us from evaluating function argument
expressions of class type (by value), and prevents us from
returning values with a class type (by value), if that class
has a non-trivial constructor or copy constructor.

For now we will allow the StoredValue to do a bit copy, with
the expectation that in the future StoredValue will hold
values of class type by pointer or reference instead of making
a copy.
This commit is contained in:
Paul Russo 2013-08-27 17:12:02 -05:00 committed by sftnight
parent b4e6d23d4c
commit 7fa8507477

View File

@ -36,7 +36,8 @@ namespace cling {
m_Sema);
if (lastExpr) {
QualType RetTy = lastExpr->getType();
if (!RetTy->isVoidType() && RetTy.isTriviallyCopyableType(*m_Context)) {
//if (!RetTy->isVoidType() && RetTy.isTriviallyCopyableType(*m_Context))
if (!RetTy->isVoidType()) {
// Change the void function's return type
// We can't PushDeclContext, because we don't have scope.
Sema::ContextRAII pushedDC(*m_Sema, FD);
@ -79,8 +80,9 @@ namespace cling {
}
}
if (!RetTy->isVoidType()
&& RetTy.isTriviallyCopyableType(*m_Context)) {
//if (!RetTy->isVoidType()
// && RetTy.isTriviallyCopyableType(*m_Context))
if (!RetTy->isVoidType()) {
Sema::ContextRAII pushedDC(*m_Sema, FD);
FunctionProtoType::ExtProtoInfo EPI;
QualType FnTy