[PATCH] D56665: [AST] Fix double-traversal of code in top-level lambdas in RAV(implicit = yes).

Sam McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 14 07:04:22 PST 2019


sammccall marked an inline comment as done.
sammccall added inline comments.


================
Comment at: unittests/Tooling/RecursiveASTVisitorTests/LambdaExpr.cpp:72
+  Visitor.ExpectMatch("", 1, 10);
+  Visitor.ExpectMatch("", 1, 14);
+  EXPECT_TRUE(Visitor.runOver("auto x = []{ [] {}; };",
----------------
Dirty secret: this is the line that catches the old bug.
The outer lambda was only traversed once (because the *lambdaexpr* was only traversed once) but its body, and thus the inner lambda was traversed twice (causing an assertion).

It'd be possible to express more directly, but it would require hacking up the fixture more, and this new test conveniently tests the lambda-in-lambda-with-VisitImplicitCode case that I forgot in the last patch.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D56665/new/

https://reviews.llvm.org/D56665





More information about the cfe-commits mailing list