diff options
author | Sean Callanan <scallanan@apple.com> | 2012-05-16 21:03:38 +0000 |
---|---|---|
committer | Sean Callanan <scallanan@apple.com> | 2012-05-16 21:03:38 +0000 |
commit | 8d825786d17a5732d3e2e37e0bb50f4debd94633 (patch) | |
tree | dc7d54b87988aa0d51ef5c1ed47d440ad36ae61b /lldb/source/Expression/ASTResultSynthesizer.cpp | |
parent | 3ef9c44747fbe74cf1e55c10edfd7f7c5c248618 (diff) | |
download | bcm5719-llvm-8d825786d17a5732d3e2e37e0bb50f4debd94633.tar.gz bcm5719-llvm-8d825786d17a5732d3e2e37e0bb50f4debd94633.zip |
Enabled C++11 in the expression parser. auto and
various other syntactic sugar work. Lambdas do
not due to some problems relocating code containing
lambdas. Rvalue references work when returned from
expressions, but need more testing.
llvm-svn: 156948
Diffstat (limited to 'lldb/source/Expression/ASTResultSynthesizer.cpp')
-rw-r--r-- | lldb/source/Expression/ASTResultSynthesizer.cpp | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/lldb/source/Expression/ASTResultSynthesizer.cpp b/lldb/source/Expression/ASTResultSynthesizer.cpp index 2c7533864b5..f40266ce358 100644 --- a/lldb/source/Expression/ASTResultSynthesizer.cpp +++ b/lldb/source/Expression/ASTResultSynthesizer.cpp @@ -260,6 +260,21 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body, // No auxiliary variable necessary; expression returns void return true; + // In C++11, last_expr can be a LValueToRvalue implicit cast. Strip that off if that's the + // case. + + do { + ImplicitCastExpr *implicit_cast = dyn_cast<ImplicitCastExpr>(last_expr); + + if (!implicit_cast) + break; + + if (!implicit_cast->getCastKind() == CK_LValueToRValue) + break; + + last_expr = implicit_cast->getSubExpr(); + } while (0); + // is_lvalue is used to record whether the expression returns an assignable Lvalue or an // Rvalue. This is relevant because they are handled differently. // @@ -354,7 +369,7 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body, ExprResult address_of_expr = m_sema->CreateBuiltinUnaryOp(SourceLocation(), UO_AddrOf, last_expr); - m_sema->AddInitializerToDecl(result_decl, address_of_expr.take(), true, true); + m_sema->AddInitializerToDecl(result_decl, address_of_expr.take(), true, false); } else { @@ -373,7 +388,7 @@ ASTResultSynthesizer::SynthesizeBodyResult (CompoundStmt *Body, if (!result_decl) return false; - m_sema->AddInitializerToDecl(result_decl, last_expr, true, true); + m_sema->AddInitializerToDecl(result_decl, last_expr, true, false); } DC->addDecl(result_decl); |