r209246 - RAV reunification: merge Lambda body visitation to DRAV
Alp Toker
alp at nuanti.com
Tue May 20 15:03:39 PDT 2014
Author: alp
Date: Tue May 20 17:03:39 2014
New Revision: 209246
URL: http://llvm.org/viewvc/llvm-project?rev=209246&view=rev
Log:
RAV reunification: merge Lambda body visitation to DRAV
Modified:
cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
cfe/trunk/tools/libclang/IndexBody.cpp
Modified: cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h?rev=209246&r1=209245&r2=209246&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h (original)
+++ cfe/trunk/include/clang/AST/DataRecursiveASTVisitor.h Tue May 20 17:03:39 2014
@@ -240,7 +240,15 @@ public:
/// \brief Recursively visit a lambda capture.
///
/// \returns false if the visitation was terminated early, true otherwise.
- bool TraverseLambdaCapture(LambdaCapture C);
+ bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C);
+
+ /// \brief Recursively visit the body of a lambda expression.
+ ///
+ /// This provides a hook for visitors that need more context when visiting
+ /// \c LE->getBody().
+ ///
+ /// \returns false if the visitation was terminated early, true otherwise.
+ bool TraverseLambdaBody(LambdaExpr *LE);
// ---- Methods on Attrs ----
@@ -777,7 +785,18 @@ bool RecursiveASTVisitor<Derived>::Trave
}
template <typename Derived>
-bool RecursiveASTVisitor<Derived>::TraverseLambdaCapture(LambdaCapture C) {
+bool
+RecursiveASTVisitor<Derived>::TraverseLambdaCapture(LambdaExpr *LE,
+ const LambdaCapture *C) {
+ if (C->isInitCapture())
+ TRY_TO(TraverseDecl(C->getCapturedVar()));
+ return true;
+}
+
+template <typename Derived>
+bool RecursiveASTVisitor<Derived>::TraverseLambdaBody(LambdaExpr *LE) {
+ StmtQueueAction StmtQueue(*this);
+ StmtQueue.queue(LE->getBody());
return true;
}
@@ -2090,7 +2109,7 @@ bool RecursiveASTVisitor<Derived>::Trave
for (LambdaExpr::capture_iterator C = S->explicit_capture_begin(),
CEnd = S->explicit_capture_end();
C != CEnd; ++C) {
- TRY_TO(TraverseLambdaCapture(*C));
+ TRY_TO(TraverseLambdaCapture(S, C));
}
if (S->hasExplicitParameters() || S->hasExplicitResultType()) {
@@ -2110,8 +2129,7 @@ bool RecursiveASTVisitor<Derived>::Trave
}
}
- StmtQueueAction StmtQueue(*this);
- StmtQueue.queue(S->getBody());
+ TRY_TO(TraverseLambdaBody(S));
return true;
}
Modified: cfe/trunk/tools/libclang/IndexBody.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/IndexBody.cpp?rev=209246&r1=209245&r2=209246&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/IndexBody.cpp (original)
+++ cfe/trunk/tools/libclang/IndexBody.cpp Tue May 20 17:03:39 2014
@@ -149,13 +149,13 @@ public:
return true;
}
- bool TraverseLambdaCapture(LambdaCapture C) {
- if (C.capturesThis())
+ bool TraverseLambdaCapture(LambdaExpr *LE, const LambdaCapture *C) {
+ if (C->capturesThis())
return true;
- if (C.capturesVariable() && IndexCtx.shouldIndexFunctionLocalSymbols())
- IndexCtx.handleReference(C.getCapturedVar(), C.getLocation(),
- Parent, ParentDC);
+ if (C->capturesVariable() && IndexCtx.shouldIndexFunctionLocalSymbols())
+ IndexCtx.handleReference(C->getCapturedVar(), C->getLocation(), Parent,
+ ParentDC);
// FIXME: Lambda init-captures.
return true;
More information about the cfe-commits
mailing list