summaryrefslogtreecommitdiff
path: root/include/clang/Basic/StmtNodes.td
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2011-06-21 17:03:29 +0000
committerDouglas Gregor <dgregor@apple.com>2011-06-21 17:03:29 +0000
commit03e80030515c800d1ab44125b9052dfffd1bd04c (patch)
tree4ef971a4ce700937aabf19c08f2bfd4f826a7a91 /include/clang/Basic/StmtNodes.td
parent65aa6885818d4b4eea2e5a9d12085b2398148662 (diff)
downloadclang-03e80030515c800d1ab44125b9052dfffd1bd04c.tar.gz
clang-03e80030515c800d1ab44125b9052dfffd1bd04c.tar.bz2
clang-03e80030515c800d1ab44125b9052dfffd1bd04c.tar.xz
Introduce a new AST node describing reference binding to temporaries.
MaterializeTemporaryExpr captures a reference binding to a temporary value, making explicit that the temporary value (a prvalue) needs to be materialized into memory so that its address can be used. The intended AST invariant here is that a reference will always bind to a glvalue, and MaterializeTemporaryExpr will be used to convert prvalues into glvalues for that binding to happen. For example, given const int& r = 1.0; The initializer of "r" will be a MaterializeTemporaryExpr whose subexpression is an implicit conversion from the double literal "1.0" to an integer value. IR generation benefits most from this new node, since it was previously guessing (badly) when to materialize temporaries for the purposes of reference binding. There are likely more refactoring and cleanups we could perform there, but the introduction of MaterializeTemporaryExpr fixes PR9565, a case where IR generation would effectively bind a const reference directly to a bitfield in a struct. Addresses <rdar://problem/9552231>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@133521 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Basic/StmtNodes.td')
-rw-r--r--include/clang/Basic/StmtNodes.td1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/clang/Basic/StmtNodes.td b/include/clang/Basic/StmtNodes.td
index f503950c20..c07953eeca 100644
--- a/include/clang/Basic/StmtNodes.td
+++ b/include/clang/Basic/StmtNodes.td
@@ -121,6 +121,7 @@ def CXXNoexceptExpr : DStmt<Expr>;
def PackExpansionExpr : DStmt<Expr>;
def SizeOfPackExpr : DStmt<Expr>;
def SubstNonTypeTemplateParmPackExpr : DStmt<Expr>;
+def MaterializeTemporaryExpr : DStmt<Expr>;
// Obj-C Expressions.
def ObjCStringLiteral : DStmt<Expr>;