[cfe-commits] r103389 - /cfe/trunk/include/clang/AST/ExprCXX.h
Chandler Carruth
chandlerc at gmail.com
Sun May 9 17:56:19 PDT 2010
Author: chandlerc
Date: Sun May 9 19:56:18 2010
New Revision: 103389
URL: http://llvm.org/viewvc/llvm-project?rev=103389&view=rev
Log:
Doxygen-ify a comment and add an example of when this AST node is required.
Modified:
cfe/trunk/include/clang/AST/ExprCXX.h
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=103389&r1=103388&r2=103389&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Sun May 9 19:56:18 2010
@@ -564,8 +564,20 @@
const CXXDestructorDecl *getDestructor() const { return Destructor; }
};
-/// CXXBindTemporaryExpr - Represents binding an expression to a temporary,
-/// so its destructor can be called later.
+/// \brief Represents binding an expression to a temporary.
+///
+/// This ensures the destructor is called for the temporary. It should only be
+/// needed for non-POD, non-trivially destructable class types. For example:
+///
+/// \code
+/// struct S {
+/// S() { } // User defined constructor makes S non-POD.
+/// ~S() { } // User defined destructor makes it non-trivial.
+/// };
+/// void test() {
+/// const S &s_ref = S(); // Requires a CXXBindTemporaryExpr.
+/// }
+/// \endcode
class CXXBindTemporaryExpr : public Expr {
CXXTemporary *Temp;
More information about the cfe-commits
mailing list