File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -5616,13 +5616,6 @@ bool Tokenizer::simplifyTokenList1(const char FileName[])
56165616 // If typedef handling is refactored and moved to symboldatabase someday we can remove this
56175617 prepareTernaryOpForAST ();
56185618
5619- for (Token* tok = list.front (); tok;) {
5620- if (Token::Match (tok, " union|struct|class union|struct|class" ))
5621- tok->deleteNext ();
5622- else
5623- tok = tok->next ();
5624- }
5625-
56265619 // class x y {
56275620 if (isCPP () && mSettings ->severity .isEnabled (Severity::information)) {
56285621 for (const Token *tok = list.front (); tok; tok = tok->next ()) {
Original file line number Diff line number Diff line change @@ -103,6 +103,7 @@ class TestVarID : public TestFixture {
103103 TEST_CASE (varid_for_2);
104104 TEST_CASE (varid_cpp_keywords_in_c_code);
105105 TEST_CASE (varid_cpp_keywords_in_c_code2); // #5373: varid=0 for argument called "delete"
106+ TEST_CASE (varid_cpp_keywords_in_c_code3);
106107 TEST_CASE (varidFunctionCall1);
107108 TEST_CASE (varidFunctionCall2);
108109 TEST_CASE (varidFunctionCall3);
@@ -1298,6 +1299,12 @@ class TestVarID : public TestFixture {
12981299 tokenize (code, " test.c" );
12991300 }
13001301
1302+ void varid_cpp_keywords_in_c_code3 () { // #12120
1303+ const char code[] = " const struct class *p;" ;
1304+ const char expected[] = " 1: const struct class * p@1 ;\n " ;
1305+ ASSERT_EQUALS (expected, tokenize (code, " test.c" ));
1306+ }
1307+
13011308 void varidFunctionCall1 () {
13021309 const char code[] =" void f() {\n "
13031310 " int x;\n "
You can’t perform that action at this time.
0 commit comments