r185674 - Add some more documentation on how to navigate from a LambdaExpr::Capture
James Dennett
jdennett at google.com
Thu Jul 4 15:15:44 PDT 2013
Author: jdennett
Date: Thu Jul 4 17:15:44 2013
New Revision: 185674
URL: http://llvm.org/viewvc/llvm-project?rev=185674&view=rev
Log:
Add some more documentation on how to navigate from a LambdaExpr::Capture
to the associated FieldDecl.
Modified:
cfe/trunk/include/clang/AST/DeclCXX.h
cfe/trunk/include/clang/AST/ExprCXX.h
Modified: cfe/trunk/include/clang/AST/DeclCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DeclCXX.h?rev=185674&r1=185673&r2=185674&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DeclCXX.h (original)
+++ cfe/trunk/include/clang/AST/DeclCXX.h Thu Jul 4 17:15:44 2013
@@ -984,16 +984,17 @@ public:
bool isLambda() const { return hasDefinition() && data().IsLambda; }
/// \brief For a closure type, retrieve the mapping from captured
- /// variables and this to the non-static data members that store the
+ /// variables and \c this to the non-static data members that store the
/// values or references of the captures.
///
/// \param Captures Will be populated with the mapping from captured
/// variables to the corresponding fields.
///
/// \param ThisCapture Will be set to the field declaration for the
- /// 'this' capture.
+ /// \c this capture.
///
- /// \note No entries will be added for init-captures.
+ /// \note No entries will be added for init-captures, as they do not capture
+ /// variables.
void getCaptureFields(llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures,
FieldDecl *&ThisCapture) const;
Modified: cfe/trunk/include/clang/AST/ExprCXX.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/ExprCXX.h?rev=185674&r1=185673&r2=185674&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/ExprCXX.h (original)
+++ cfe/trunk/include/clang/AST/ExprCXX.h Thu Jul 4 17:15:44 2013
@@ -1401,6 +1401,10 @@ public:
}
/// \brief Retrieve the field for an init-capture.
+ ///
+ /// This works only for an init-capture. To retrieve the FieldDecl for
+ /// a captured variable or for a capture of \c this, use
+ /// LambdaExpr::getLambdaClass and CXXRecordDecl::getCaptureFields.
FieldDecl *getInitCaptureField() const {
assert(getCaptureKind() == LCK_Init && "no field for non-init-capture");
return cast<FieldDecl>(DeclAndBits.getPointer());
@@ -1410,8 +1414,8 @@ public:
/// written between the square brackets introducing the lambda).
bool isImplicit() const { return DeclAndBits.getInt() & Capture_Implicit; }
- /// \brief Determine whether this was an explicit capture, written
- /// between the square brackets introducing the lambda.
+ /// \brief Determine whether this was an explicit capture (written
+ /// between the square brackets introducing the lambda).
bool isExplicit() const { return !isImplicit(); }
/// \brief Retrieve the source location of the capture.
More information about the cfe-commits
mailing list