Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions lib/tokenize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4704,6 +4704,16 @@ void Tokenizer::setVarIdPass1()
bool initlist = false;
bool inlineFunction = false;
for (Token *tok = list.front(); tok; tok = tok->next()) {
if (Token::simpleMatch(tok, ") (") && Token::simpleMatch(tok->link(), "( *")) {
const Token *typeTok = tok->link()->previous();
while (Token::Match(typeTok, "*|&")) {
typeTok = tok->previous();
}
if (Token::Match(typeTok, "%type%")) {
tok = tok->linkAt(1);
continue;
}
}
if (tok->isOp())
continue;
if (cpp && Token::simpleMatch(tok, "template <")) {
Expand Down
2 changes: 1 addition & 1 deletion test/testvarid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1328,7 +1328,7 @@ class TestVarID : public TestFixture {
ASSERT_EQUALS(expected2, tokenize(code2));

const char code3[] = "extern void (*arr[10])(uint32_t some);\n";
const char expected3[] = "1: extern void ( * arr@1 [ 10 ] ) ( uint32_t some@2 ) ;\n";
const char expected3[] = "1: extern void ( * arr@1 [ 10 ] ) ( uint32_t some ) ;\n";
ASSERT_EQUALS(expected3, tokenize(code3));

const char code4[] = "_Static_assert(sizeof((struct S){0}.i) == 4);\n"; // #12729
Expand Down
Loading