summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJames Dennett <jdennett@google.com>2013-07-04 22:15:44 +0000
committerJames Dennett <jdennett@google.com>2013-07-04 22:15:44 +0000
commitc65f03498f6c59b5ae5c14086f49ae6e7a173624 (patch)
tree2f8f14857cf852551ac9dda4795aaa61728934a7 /include
parenta2405c6e5124126f2b59ba3313ebc14b56e5272d (diff)
downloadclang-c65f03498f6c59b5ae5c14086f49ae6e7a173624.tar.gz
Add some more documentation on how to navigate from a LambdaExpr::Capture
to the associated FieldDecl. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@185674 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/clang/AST/DeclCXX.h7
-rw-r--r--include/clang/AST/ExprCXX.h8
2 files changed, 10 insertions, 5 deletions
diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h
index 2de99f0925..3108457492 100644
--- a/include/clang/AST/DeclCXX.h
+++ b/include/clang/AST/DeclCXX.h
@@ -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;
diff --git a/include/clang/AST/ExprCXX.h b/include/clang/AST/ExprCXX.h
index a241d1eded..925b16697c 100644
--- a/include/clang/AST/ExprCXX.h
+++ b/include/clang/AST/ExprCXX.h
@@ -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.