Skip to content

Commit

Permalink
fixed #12715 - made Visual Studio conditions work again [skip ci]
Browse files Browse the repository at this point in the history
  • Loading branch information
firewave committed May 7, 2024
1 parent f562ff2 commit 2bfe4cd
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/importproject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@ namespace {
TokenList tokenlist(&s);
std::istringstream istr(c);
tokenlist.createTokens(istr, Standards::Language::C); // TODO: check result
tokenlist.createAst();
for (const Token *tok = tokenlist.front(); tok; tok = tok->next()) {
if (tok->str() == "(" && tok->astOperand1() && tok->astOperand2()) {
// TODO: this is wrong - it is Contains() not Equals()
Expand Down
10 changes: 10 additions & 0 deletions test/testtokenlist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class TestTokenList : public TestFixture {
TEST_CASE(inc);
TEST_CASE(isKeyword);
TEST_CASE(notokens);
TEST_CASE(ast1);
}

// inspired by #5895
Expand Down Expand Up @@ -161,6 +162,15 @@ class TestTokenList : public TestFixture {
TokenList tokenlist(&settingsDefault);
tokenlist.createTokens(std::move(tokensP)); // do not assert
}

void ast1() {
const std::string s = "('Release|x64' == 'Release|x64');";

TokenList tokenlist(&settings);
std::istringstream istr(s);
tokenlist.createTokens(istr, Standards::Language::C);
tokenlist.createAst(); // TODO: do not crash
}
};

REGISTER_TEST(TestTokenList)

0 comments on commit 2bfe4cd

Please sign in to comment.