From b8b6b4183392d75ddb3e9fd68bc7b3153a15b40a Mon Sep 17 00:00:00 2001
From: chrchr-github <78114321+chrchr-github@users.noreply.github.com>
Date: Thu, 29 Sep 2022 13:29:50 +0200
Subject: [PATCH] Fix #10802 Broken AST lambda inside for loop (#4520)
* Fix #10802 Broken AST lambda inside for loop
* Add some boost and wxwidget defines (on behalf of "david ingamells")
---
cfg/boost.cfg | 4 ++++
cfg/wxwidgets.cfg | 1 +
lib/tokenlist.cpp | 1 +
test/testtokenize.cpp | 1 +
4 files changed, 7 insertions(+)
diff --git a/cfg/boost.cfg b/cfg/boost.cfg
index e9ea1be92..0702bad74 100644
--- a/cfg/boost.cfg
+++ b/cfg/boost.cfg
@@ -16,6 +16,7 @@
+
@@ -92,6 +93,9 @@
+
+
+
diff --git a/cfg/wxwidgets.cfg b/cfg/wxwidgets.cfg
index e561a6709..6d187a423 100644
--- a/cfg/wxwidgets.cfg
+++ b/cfg/wxwidgets.cfg
@@ -276,6 +276,7 @@
+
diff --git a/lib/tokenlist.cpp b/lib/tokenlist.cpp
index 3db8e0b31..b632085ee 100644
--- a/lib/tokenlist.cpp
+++ b/lib/tokenlist.cpp
@@ -1517,6 +1517,7 @@ static Token * createAstAtToken(Token *tok, bool cpp)
}
if (!tok2 || tok2->str() != ";") {
if (tok2 == endPar && init1) {
+ createAstAtTokenInner(init1->next(), endPar, cpp);
tok->next()->astOperand2(init1);
tok->next()->astOperand1(tok);
}
diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp
index 57843ca19..20dfb5aea 100644
--- a/test/testtokenize.cpp
+++ b/test/testtokenize.cpp
@@ -5959,6 +5959,7 @@ private:
ASSERT_EQUALS("forae*bc.({:(", testAst("for (a *e : {b->c()});"));
ASSERT_EQUALS("fori0=iasize.(b; }));")); // #10802
// for with initializer (c++20)
ASSERT_EQUALS("forab=ca:;(", testAst("for(a=b;int c:a)"));