Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #9792 (SymbolDatabase: Wrong ValueType is set for function pointer usage 'using fp = int(int*)') #6715

Merged
merged 1 commit into from
Aug 21, 2024
Merged
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
2 changes: 2 additions & 0 deletions lib/symboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7166,6 +7166,8 @@ static const Token* parsedecl(const Token* type,
!type->variable() && !type->function()) {
bool isIterator = false;
if (type->str() == "(") {
if (!Token::simpleMatch(type, "( *"))
break;
if (Token::Match(type->link(), ") const| {"))
break;
if (par)
Expand Down
1 change: 1 addition & 0 deletions test/testsymboldatabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9141,6 +9141,7 @@ class TestSymbolDatabase : public TestFixture {
ASSERT_EQUALS("s", typeOf("struct s { s foo(); s(int, int); }; s s::foo() { return s(1, 2); } ", "( 1 , 2 )"));
// Some standard template functions.. TODO library configuration
ASSERT_EQUALS("signed int &&", typeOf("std::move(5);", "( 5 )"));
ASSERT_EQUALS("signed int", typeOf("using F = int(int*); F* f; f(ptr);", "( ptr")); // #9792

// struct member..
ASSERT_EQUALS("signed int", typeOf("struct AB { int a; int b; } ab; x = ab.a;", "."));
Expand Down
Loading