llvm-project/clang/lib/AST
Douglas Gregor fe31481f68 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>.

llvm-svn: 133521
2011-06-21 17:03:29 +00:00
..
APValue.cpp Refactoring of constant expression evaluator 2011-05-13 03:29:01 +00:00
ASTConsumer.cpp Reintroduce the ASTConsumer/ASTUnit fix from r110610, it has nothing to do with the breakage. 2010-08-11 18:52:41 +00:00
ASTContext.cpp Fix regression with @encode string. rdar://9624314. 2011-06-17 23:19:38 +00:00
ASTDiagnostic.cpp Implement support for C++0x alias templates. 2011-05-05 21:57:07 +00:00
ASTImporter.cpp Implement support for C++11 in-class initialization of non-static data members. 2011-06-11 17:19:42 +00:00
AttrImpl.cpp Generate Attr subclasses with TableGen. 2010-08-18 23:23:40 +00:00
CMakeLists.txt Unbreak CMake build 2011-02-28 14:32:11 +00:00
CXXABI.h Move isNearlyEmpty out into the ASTContext so it can be called from CodeGen as well. 2010-11-25 01:51:53 +00:00
CXXInheritance.cpp Support for C++11 (non-template) alias declarations. 2011-04-15 14:24:37 +00:00
Decl.cpp Introduce a new AST node describing reference binding to temporaries. 2011-06-21 17:03:29 +00:00
DeclBase.cpp Implement a minor optimization by not introducing declarations into 2011-05-06 23:32:38 +00:00
DeclCXX.cpp Automatic Reference Counting. 2011-06-15 23:02:42 +00:00
DeclFriend.cpp Support C++ friend declarations for PCH. 2010-06-29 22:47:00 +00:00
DeclGroup.cpp I lied. Kill off a few more Destroy methods 2010-07-25 18:32:30 +00:00
DeclObjC.cpp Objective-C fast enumeration loop variables are not retained in ARC, but 2011-06-17 06:42:21 +00:00
DeclPrinter.cpp Automatic Reference Counting. 2011-06-15 23:02:42 +00:00
DeclTemplate.cpp Implement support for C++0x alias templates. 2011-05-05 21:57:07 +00:00
DeclarationName.cpp Selector::getIdentifierInfoForSlot() can return NULL values, a fact 2011-02-18 22:29:55 +00:00
DumpXML.cpp Implement Objective-C Related Result Type semantics. 2011-06-11 01:09:30 +00:00
Expr.cpp Introduce a new AST node describing reference binding to temporaries. 2011-06-21 17:03:29 +00:00
ExprCXX.cpp Make yet another placeholder type, this one marking that an expression is a bound 2011-04-26 20:42:42 +00:00
ExprClassification.cpp Introduce a new AST node describing reference binding to temporaries. 2011-06-21 17:03:29 +00:00
ExprConstant.cpp Introduce a new AST node describing reference binding to temporaries. 2011-06-21 17:03:29 +00:00
ExternalASTSource.cpp From Vassil Vassilev: 2011-05-04 12:59:24 +00:00
InheritViz.cpp Revert 123553, as sys::fs::unique_file is not finished yet. 2011-03-01 19:50:49 +00:00
ItaniumCXXABI.cpp fix a bunch of comment typos found by codespell. Patch by 2011-04-15 05:22:18 +00:00
ItaniumMangle.cpp Introduce a new AST node describing reference binding to temporaries. 2011-06-21 17:03:29 +00:00
Makefile BUILD_ARCHIVE is the default for libraries, no need to set it. 2010-07-18 00:14:47 +00:00
Mangle.cpp Implement support for C++11 in-class initialization of non-static data members. 2011-06-11 17:19:42 +00:00
MicrosoftCXXABI.cpp fix a bunch of comment typos found by codespell. Patch by 2011-04-15 05:22:18 +00:00
MicrosoftMangle.cpp Implement a new type node, UnaryTransformType, designed to represent a 2011-05-24 22:41:36 +00:00
NestedNameSpecifier.cpp Refactor the construction of nested-name-specifiers with 2011-02-28 23:58:31 +00:00
ParentMap.cpp Automatic Reference Counting. 2011-06-15 23:02:42 +00:00
RecordLayout.cpp Convert RecordLayout::Alignment to CharUnits from bit units. No change in 2011-02-15 02:32:40 +00:00
RecordLayoutBuilder.cpp PR10120: Make CodeGenModule::getVTableLinkage use NamedDecl::getLinkage to determine whether the vtable should be externally visible, instead of a rough approximation of it which messes up with templates. 2011-06-10 21:53:06 +00:00
Stmt.cpp Parsing/AST support for Structured Exception Handling 2011-04-28 01:08:34 +00:00
StmtDumper.cpp Add an optional field attached to a DeclRefExpr which points back to the 2011-05-01 23:48:14 +00:00
StmtIterator.cpp Support for C++11 (non-template) alias declarations. 2011-04-15 14:24:37 +00:00
StmtPrinter.cpp Introduce a new AST node describing reference binding to temporaries. 2011-06-21 17:03:29 +00:00
StmtProfile.cpp Introduce a new AST node describing reference binding to temporaries. 2011-06-21 17:03:29 +00:00
StmtViz.cpp Adapt to the DOTGraphTraits changes in LLVM. 2009-11-30 14:16:05 +00:00
TemplateBase.cpp Objective-ARC++: infer template type arguments of 2011-06-17 22:11:49 +00:00
TemplateName.cpp Teach Sema::ActOnCXXNestedNameSpecifier and Sema::CheckTemplateIdType 2011-03-04 21:37:14 +00:00
Type.cpp Restructure the API in Type based on a conversation with Richard Smith. 2011-06-20 01:23:19 +00:00
TypeLoc.cpp Make yet another placeholder type, this one marking that an expression is a bound 2011-04-26 20:42:42 +00:00
TypePrinter.cpp Automatic Reference Counting. 2011-06-15 23:02:42 +00:00