diff options
Diffstat (limited to 'clang/lib/AST')
-rw-r--r-- | clang/lib/AST/Decl.cpp | 4 | ||||
-rw-r--r-- | clang/lib/AST/DeclBase.cpp | 2 | ||||
-rw-r--r-- | clang/lib/AST/Stmt.cpp | 16 | ||||
-rw-r--r-- | clang/lib/AST/StmtPrinter.cpp | 2 |
4 files changed, 15 insertions, 9 deletions
diff --git a/clang/lib/AST/Decl.cpp b/clang/lib/AST/Decl.cpp index 36044826e83..d572335fb3d 100644 --- a/clang/lib/AST/Decl.cpp +++ b/clang/lib/AST/Decl.cpp @@ -3234,6 +3234,10 @@ MSPropertyDecl *MSPropertyDecl::CreateDeserialized(ASTContext &C, 0, 0); } +CapturedDecl *CapturedDecl::Create(ASTContext &C, DeclContext *DC) { + return new (C) CapturedDecl(DC); +} + EnumConstantDecl *EnumConstantDecl::Create(ASTContext &C, EnumDecl *CD, SourceLocation L, IdentifierInfo *Id, QualType T, diff --git a/clang/lib/AST/DeclBase.cpp b/clang/lib/AST/DeclBase.cpp index 3f23f3d855c..402d83683aa 100644 --- a/clang/lib/AST/DeclBase.cpp +++ b/clang/lib/AST/DeclBase.cpp @@ -553,6 +553,7 @@ unsigned Decl::getIdentifierNamespaceForKind(Kind DeclKind) { case StaticAssert: case ObjCPropertyImpl: case Block: + case Captured: case TranslationUnit: case UsingDirective: @@ -839,6 +840,7 @@ DeclContext *DeclContext::getPrimaryContext() { case Decl::TranslationUnit: case Decl::LinkageSpec: case Decl::Block: + case Decl::Captured: // There is only one DeclContext for these entities. return this; diff --git a/clang/lib/AST/Stmt.cpp b/clang/lib/AST/Stmt.cpp index e120c6a1f87..2a7b1702220 100644 --- a/clang/lib/AST/Stmt.cpp +++ b/clang/lib/AST/Stmt.cpp @@ -1038,12 +1038,12 @@ CapturedStmt::Capture *CapturedStmt::getStoredCaptures() const { CapturedStmt::CapturedStmt(Stmt *S, ArrayRef<Capture> Captures, ArrayRef<Expr *> CaptureInits, - FunctionDecl *FD, + CapturedDecl *CD, RecordDecl *RD) : Stmt(CapturedStmtClass), NumCaptures(Captures.size()), - TheFuncDecl(FD), TheRecordDecl(RD) { + TheCapturedDecl(CD), TheRecordDecl(RD) { assert( S && "null captured statement"); - assert(FD && "null function declaration for captured statement"); + assert(CD && "null captured declaration for captured statement"); assert(RD && "null record declaration for captured statement"); // Copy initialization expressions. @@ -1061,14 +1061,14 @@ CapturedStmt::CapturedStmt(Stmt *S, ArrayRef<Capture> Captures, CapturedStmt::CapturedStmt(EmptyShell Empty, unsigned NumCaptures) : Stmt(CapturedStmtClass, Empty), NumCaptures(NumCaptures), - TheFuncDecl(0), TheRecordDecl(0) { + TheCapturedDecl(0), TheRecordDecl(0) { getStoredStmts()[NumCaptures] = 0; } CapturedStmt *CapturedStmt::Create(ASTContext &Context, Stmt *S, ArrayRef<Capture> Captures, ArrayRef<Expr *> CaptureInits, - FunctionDecl *FD, + CapturedDecl *CD, RecordDecl *RD) { // The layout is // @@ -1089,7 +1089,7 @@ CapturedStmt *CapturedStmt::Create(ASTContext &Context, Stmt *S, } void *Mem = Context.Allocate(Size); - return new (Mem) CapturedStmt(S, Captures, CaptureInits, FD, RD); + return new (Mem) CapturedStmt(S, Captures, CaptureInits, CD, RD); } CapturedStmt *CapturedStmt::CreateDeserialized(ASTContext &Context, @@ -1106,8 +1106,8 @@ CapturedStmt *CapturedStmt::CreateDeserialized(ASTContext &Context, } Stmt::child_range CapturedStmt::children() { - // Children are captured field initilizers and the statement being captured. - return child_range(getStoredStmts(), getStoredStmts() + NumCaptures + 1); + // Children are captured field initilizers. + return child_range(getStoredStmts(), getStoredStmts() + NumCaptures); } bool CapturedStmt::capturesVariable(const VarDecl *Var) const { diff --git a/clang/lib/AST/StmtPrinter.cpp b/clang/lib/AST/StmtPrinter.cpp index 469c2846a64..1b2285c7948 100644 --- a/clang/lib/AST/StmtPrinter.cpp +++ b/clang/lib/AST/StmtPrinter.cpp @@ -451,7 +451,7 @@ void StmtPrinter::VisitMSAsmStmt(MSAsmStmt *Node) { } void StmtPrinter::VisitCapturedStmt(CapturedStmt *Node) { - PrintStmt(Node->getCapturedStmt()); + PrintStmt(Node->getCapturedDecl()->getBody()); } void StmtPrinter::VisitObjCAtTryStmt(ObjCAtTryStmt *Node) { |