diff options
Diffstat (limited to 'include/clang')
-rw-r--r-- | include/clang/AST/ASTContext.h | 8 | ||||
-rw-r--r-- | include/clang/AST/DeclCXX.h | 20 |
2 files changed, 26 insertions, 2 deletions
diff --git a/include/clang/AST/ASTContext.h b/include/clang/AST/ASTContext.h index 3236977030..82570f594d 100644 --- a/include/clang/AST/ASTContext.h +++ b/include/clang/AST/ASTContext.h @@ -59,6 +59,7 @@ namespace clang { class CXXRecordDecl; class Decl; class FieldDecl; + class LambdaExpr; class MangleContext; class ObjCIvarDecl; class ObjCIvarRefExpr; @@ -163,6 +164,10 @@ class ASTContext : public llvm::RefCountedBase<ASTContext> { llvm::DenseMap<const FunctionDecl*, FunctionDecl*> ClassScopeSpecializationPattern; + /// \brief Mapping from closure types to the lambda expressions that + /// create instances of them. + llvm::DenseMap<const CXXRecordDecl *, LambdaExpr *> Lambdas; + /// \brief Representation of a "canonical" template template parameter that /// is used in canonical template names. class CanonicalTemplateTemplateParm : public llvm::FoldingSetNode { @@ -358,7 +363,8 @@ class ASTContext : public llvm::RefCountedBase<ASTContext> { friend class ASTDeclReader; friend class ASTReader; friend class ASTWriter; - + friend class CXXRecordDecl; + const TargetInfo *Target; clang::PrintingPolicy PrintingPolicy; diff --git a/include/clang/AST/DeclCXX.h b/include/clang/AST/DeclCXX.h index f33b762644..5d333fa41b 100644 --- a/include/clang/AST/DeclCXX.h +++ b/include/clang/AST/DeclCXX.h @@ -19,6 +19,7 @@ #include "clang/AST/Decl.h" #include "clang/AST/TypeLoc.h" #include "clang/AST/UnresolvedSet.h" +#include "llvm/ADT/DenseMap.h" #include "llvm/ADT/PointerIntPair.h" #include "llvm/ADT/SmallPtrSet.h" @@ -37,6 +38,7 @@ class CXXMemberLookupCriteria; class CXXFinalOverriderMap; class CXXIndirectPrimaryBaseSet; class FriendDecl; +class LambdaExpr; /// \brief Represents any kind of function declaration, whether it is a /// concrete function or a function template. @@ -925,7 +927,23 @@ public: /// \brief Determine whether this class describes a lambda function object. bool isLambda() const { return hasDefinition() && data().IsLambda; } - void setLambda(bool Lambda = true) { data().IsLambda = Lambda; } + /// \brief Mark this as a closure type from a lambda expression. + void makeLambda() { data().IsLambda = true; } + + /// \brief Set the lambda expression associated with this closure type. + void setLambda(LambdaExpr *Lambda); + + /// \brief For a closure type, retrieve the mapping from captured + /// variables and 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. + void getCaptureFields(llvm::DenseMap<const VarDecl *, FieldDecl *> &Captures, + FieldDecl *&ThisCapture); /// getConversions - Retrieve the overload set containing all of the /// conversion functions in this class. |