Fix #11422 debug: Missing variable class for variable with varid (#4616)

This commit is contained in:
chrchr-github 2022-12-08 20:17:06 +01:00 committed by GitHub
parent 0cb742701d
commit c779cefa61
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 1 deletions

View File

@ -5639,7 +5639,7 @@ void Tokenizer::removePragma()
void Tokenizer::removeMacroInClassDef() void Tokenizer::removeMacroInClassDef()
{ {
for (Token *tok = list.front(); tok; tok = tok->next()) { for (Token *tok = list.front(); tok; tok = tok->next()) {
if (!Token::Match(tok, "class|struct %name% %name% {|:")) if (!Token::Match(tok, "class|struct %name% %name% final| {|:"))
continue; continue;
const bool nextIsUppercase = tok->next()->isUpperCaseName(); const bool nextIsUppercase = tok->next()->isUpperCaseName();

View File

@ -6634,6 +6634,7 @@ private:
void removeMacroInClassDef() { // #6058 void removeMacroInClassDef() { // #6058
ASSERT_EQUALS("class Fred { } ;", tokenizeAndStringify("class DLLEXPORT Fred { } ;")); ASSERT_EQUALS("class Fred { } ;", tokenizeAndStringify("class DLLEXPORT Fred { } ;"));
ASSERT_EQUALS("class Fred : Base { } ;", tokenizeAndStringify("class Fred FINAL : Base { } ;")); ASSERT_EQUALS("class Fred : Base { } ;", tokenizeAndStringify("class Fred FINAL : Base { } ;"));
ASSERT_EQUALS("class Fred final : Base { } ;", tokenizeAndStringify("class DLLEXPORT Fred final : Base { } ;")); // #11422
// Regression for C code: // Regression for C code:
ASSERT_EQUALS("struct Fred { } ;", tokenizeAndStringify("struct DLLEXPORT Fred { } ;", true, Settings::Native, "test.c")); ASSERT_EQUALS("struct Fred { } ;", tokenizeAndStringify("struct DLLEXPORT Fred { } ;", true, Settings::Native, "test.c"));
} }