diff options
Diffstat (limited to 'clang/lib/AST/Stmt.cpp')
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index 10434463b88..ca63d8486d8 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -972,6 +972,17 @@ CapturedStmt::Capture::Capture(SourceLocation Loc, VariableCaptureKind Kind, } } +CapturedStmt::VariableCaptureKind +CapturedStmt::Capture::getCaptureKind() const { + return VarAndKind.getInt(); +} + +VarDecl *CapturedStmt::Capture::getCapturedVar() const { + assert((capturesVariable() || capturesVariableByCopy()) && + "No variable available for 'this' or VAT capture"); + return VarAndKind.getPointer(); +} + CapturedStmt::Capture *CapturedStmt::getStoredCaptures() const { unsigned Size = sizeof(CapturedStmt) + sizeof(Stmt *) * (NumCaptures + 1); @@ -1060,6 +1071,29 @@ Stmt::child_range CapturedStmt::children() { return child_range(getStoredStmts(), getStoredStmts() + NumCaptures); } +CapturedDecl *CapturedStmt::getCapturedDecl() { + return CapDeclAndKind.getPointer(); +} +const CapturedDecl *CapturedStmt::getCapturedDecl() const { + return CapDeclAndKind.getPointer(); +} + +/// \brief Set the outlined function declaration. +void CapturedStmt::setCapturedDecl(CapturedDecl *D) { + assert(D && "null CapturedDecl"); + CapDeclAndKind.setPointer(D); +} + +/// \brief Retrieve the captured region kind. +CapturedRegionKind CapturedStmt::getCapturedRegionKind() const { + return CapDeclAndKind.getInt(); +} + +/// \brief Set the captured region kind. +void CapturedStmt::setCapturedRegionKind(CapturedRegionKind Kind) { + CapDeclAndKind.setInt(Kind); +} + bool CapturedStmt::capturesVariable(const VarDecl *Var) const { for (const auto &I : captures()) { if (!I.capturesVariable()) |