File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -9222,6 +9222,7 @@ void Tokenizer::simplifyStructDecl()
92229222 while (!Token::Match (start, " struct|class|union|enum" )) {
92239223 after->insertToken (start->str ());
92249224 after = after->next ();
9225+ after->column (start->column ());
92259226 start->deleteThis ();
92269227 }
92279228 tok = start;
Original file line number Diff line number Diff line change @@ -506,6 +506,8 @@ class TestTokenizer : public TestFixture {
506506 TEST_CASE (dumpFallthrough);
507507
508508 TEST_CASE (simplifyRedundantParentheses);
509+
510+ TEST_CASE (simplifyEnum);
509511 }
510512
511513 class TokenizerTest : public Tokenizer
@@ -8810,6 +8812,16 @@ class TestTokenizer : public TestFixture {
88108812 SimpleTokenizer tokenizer (settingsDefault, *this , false );
88118813 ASSERT_NO_THROW (tokenizer.tokenize (code));
88128814 }
8815+
8816+ void simplifyEnum () {
8817+ const char code[] = " static enum {A,B} ab;" ;
8818+ ASSERT_EQUALS (" enum Anonymous0 { A , B } ; static enum Anonymous0 ab ;" , tokenizeAndStringify (code));
8819+ SimpleTokenizer tokenizer (settingsDefault, *this );
8820+ tokenizer.tokenize (code);
8821+ const Token* tok = Token::findsimplematch (tokenizer.tokens (), " static" );
8822+ ASSERT (tok);
8823+ ASSERT_EQUALS (tok->column (), 1 );
8824+ }
88138825};
88148826
88158827REGISTER_TEST (TestTokenizer)
You can’t perform that action at this time.
0 commit comments