summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang/RecursiveASTVisitor.h
diff options
context:
space:
mode:
authorTareq A. Siraj <tareq.a.sriaj@intel.com>2013-04-16 19:37:38 +0000
committerTareq A. Siraj <tareq.a.sriaj@intel.com>2013-04-16 19:37:38 +0000
commit6dfa25a19f3f28fcdc4a4c0130bf4a6fcdce0cd1 (patch)
treee4355c0d4969b0173e9b0a10d4ed67d60a2f6994 /clang/tools/libclang/RecursiveASTVisitor.h
parent93383381d7fc1c80b3dd8711164ad858a95718ff (diff)
downloadbcm5719-llvm-6dfa25a19f3f28fcdc4a4c0130bf4a6fcdce0cd1.tar.gz
bcm5719-llvm-6dfa25a19f3f28fcdc4a4c0130bf4a6fcdce0cd1.zip
Sema for Captured Statements
Add CapturedDecl to be the DeclContext for CapturedStmt, and perform semantic analysis. Currently captures all variables by reference. TODO: templates Author: Ben Langmuir <ben.langmuir@intel.com> Differential Revision: http://llvm-reviews.chandlerc.com/D433 llvm-svn: 179618
Diffstat (limited to 'clang/tools/libclang/RecursiveASTVisitor.h')
-rw-r--r--clang/tools/libclang/RecursiveASTVisitor.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/clang/tools/libclang/RecursiveASTVisitor.h b/clang/tools/libclang/RecursiveASTVisitor.h
index 592f1687257..6c9da93b73c 100644
--- a/clang/tools/libclang/RecursiveASTVisitor.h
+++ b/clang/tools/libclang/RecursiveASTVisitor.h
@@ -1170,8 +1170,9 @@ bool RecursiveASTVisitor<Derived>::TraverseDeclContextHelper(DeclContext *DC) {
for (DeclContext::decl_iterator Child = DC->decls_begin(),
ChildEnd = DC->decls_end();
Child != ChildEnd; ++Child) {
- // BlockDecls are traversed through BlockExprs.
- if (!isa<BlockDecl>(*Child))
+ // BlockDecls and CapturedDecls are traversed through BlockExprs and
+ // CapturedStmts respectively.
+ if (!isa<BlockDecl>(*Child) && !isa<CapturedDecl>(*Child))
TRY_TO(TraverseDecl(*Child));
}
@@ -1200,6 +1201,14 @@ DEF_TRAVERSE_DECL(BlockDecl, {
return true;
})
+DEF_TRAVERSE_DECL(CapturedDecl, {
+ TRY_TO(TraverseStmt(D->getBody()));
+ // This return statement makes sure the traversal of nodes in
+ // decls_begin()/decls_end() (done in the DEF_TRAVERSE_DECL macro)
+ // is skipped - don't remove it.
+ return true;
+ })
+
DEF_TRAVERSE_DECL(EmptyDecl, { })
DEF_TRAVERSE_DECL(FileScopeAsmDecl, {
@@ -1839,7 +1848,6 @@ DEF_TRAVERSE_STMT(MSDependentExistsStmt, {
DEF_TRAVERSE_STMT(ReturnStmt, { })
DEF_TRAVERSE_STMT(SwitchStmt, { })
DEF_TRAVERSE_STMT(WhileStmt, { })
-DEF_TRAVERSE_STMT(CapturedStmt, { })
DEF_TRAVERSE_STMT(CXXDependentScopeMemberExpr, {
TRY_TO(TraverseNestedNameSpecifierLoc(S->getQualifierLoc()));
@@ -2141,6 +2149,9 @@ DEF_TRAVERSE_STMT(MSPropertyRefExpr, {})
DEF_TRAVERSE_STMT(SEHTryStmt, {})
DEF_TRAVERSE_STMT(SEHExceptStmt, {})
DEF_TRAVERSE_STMT(SEHFinallyStmt,{})
+DEF_TRAVERSE_STMT(CapturedStmt, {
+ TRY_TO(TraverseDecl(S->getCapturedDecl()));
+})
DEF_TRAVERSE_STMT(CXXOperatorCallExpr, { })
DEF_TRAVERSE_STMT(OpaqueValueExpr, { })
OpenPOWER on IntegriCloud