[PATCH] D22903: [clang-tidy] Prepare modernize-loop-convert for upcoming changes in D22566
Martin Böhme via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 1 04:37:00 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL277339: [clang-tidy] Prepare modernize-loop-convert for upcoming changes in D22566 (authored by mboehme).
Changed prior to commit:
https://reviews.llvm.org/D22903?vs=65877&id=66303#toc
Repository:
rL LLVM
https://reviews.llvm.org/D22903
Files:
clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
Index: clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
===================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
+++ clang-tools-extra/trunk/clang-tidy/modernize/LoopConvertUtils.cpp
@@ -805,6 +805,18 @@
}
bool ForLoopIndexUseVisitor::TraverseStmt(Stmt *S) {
+ // If this is an initialization expression for a lambda capture, prune the
+ // traversal so that we don't end up diagnosing the contained DeclRefExpr as
+ // inconsistent usage. No need to record the usage here -- this is done in
+ // TraverseLambdaCapture().
+ if (const auto *LE = dyn_cast_or_null<LambdaExpr>(NextStmtParent)) {
+ // Any child of a LambdaExpr that isn't the body is an initialization
+ // expression.
+ if (S != LE->getBody()) {
+ return true;
+ }
+ }
+
// All this pointer swapping is a mechanism for tracking immediate parentage
// of Stmts.
const Stmt *OldNextParent = NextStmtParent;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22903.66303.patch
Type: text/x-patch
Size: 1003 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20160801/7618f47b/attachment.bin>
More information about the cfe-commits
mailing list