From c779cefa616003e5973b6f0a16dc0b84cb018f6c Mon Sep 17 00:00:00 2001 From: chrchr-github <78114321+chrchr-github@users.noreply.github.com> Date: Thu, 8 Dec 2022 20:17:06 +0100 Subject: [PATCH] Fix #11422 debug: Missing variable class for variable with varid (#4616) --- lib/tokenize.cpp | 2 +- test/testtokenize.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 055fb7910..2ab670f8e 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -5639,7 +5639,7 @@ void Tokenizer::removePragma() void Tokenizer::removeMacroInClassDef() { 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; const bool nextIsUppercase = tok->next()->isUpperCaseName(); diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 6b57caaf7..78ac42431 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -6634,6 +6634,7 @@ private: void removeMacroInClassDef() { // #6058 ASSERT_EQUALS("class Fred { } ;", tokenizeAndStringify("class DLLEXPORT Fred { } ;")); 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: ASSERT_EQUALS("struct Fred { } ;", tokenizeAndStringify("struct DLLEXPORT Fred { } ;", true, Settings::Native, "test.c")); }