From 7fa8507477251884e912f12a7786edc3f3ac8d70 Mon Sep 17 00:00:00 2001 From: Paul Russo Date: Tue, 27 Aug 2013 17:12:02 -0500 Subject: [PATCH] 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. --- lib/Interpreter/ReturnSynthesizer.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/Interpreter/ReturnSynthesizer.cpp b/lib/Interpreter/ReturnSynthesizer.cpp index 054a5470..7c9cab2f 100644 --- a/lib/Interpreter/ReturnSynthesizer.cpp +++ b/lib/Interpreter/ReturnSynthesizer.cpp @@ -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