Skip to content

Commit 2bfe4cd

Browse files
committed
fixed #12715 - made Visual Studio conditions work again [skip ci]
1 parent f562ff2 commit 2bfe4cd

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

lib/importproject.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ namespace {
568568
TokenList tokenlist(&s);
569569
std::istringstream istr(c);
570570
tokenlist.createTokens(istr, Standards::Language::C); // TODO: check result
571+
tokenlist.createAst();
571572
for (const Token *tok = tokenlist.front(); tok; tok = tok->next()) {
572573
if (tok->str() == "(" && tok->astOperand1() && tok->astOperand2()) {
573574
// TODO: this is wrong - it is Contains() not Equals()

test/testtokenlist.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class TestTokenList : public TestFixture {
4343
TEST_CASE(inc);
4444
TEST_CASE(isKeyword);
4545
TEST_CASE(notokens);
46+
TEST_CASE(ast1);
4647
}
4748

4849
// inspired by #5895
@@ -161,6 +162,15 @@ class TestTokenList : public TestFixture {
161162
TokenList tokenlist(&settingsDefault);
162163
tokenlist.createTokens(std::move(tokensP)); // do not assert
163164
}
165+
166+
void ast1() {
167+
const std::string s = "('Release|x64' == 'Release|x64');";
168+
169+
TokenList tokenlist(&settings);
170+
std::istringstream istr(s);
171+
tokenlist.createTokens(istr, Standards::Language::C);
172+
tokenlist.createAst(); // TODO: do not crash
173+
}
164174
};
165175

166176
REGISTER_TEST(TestTokenList)

0 commit comments

Comments
 (0)