parent
847d7583e4
commit
55292d476a
|
@ -2774,11 +2774,21 @@ bool Function::argsMatch(const Scope *scope, const Token *first, const Token *se
|
|||
((first->strAt(2) != "const" && second->strAt(2) == "const") ||
|
||||
(first->strAt(2) == "const" && second->strAt(2) != "const"))) {
|
||||
if (first->strAt(2) != "const") {
|
||||
first = first->next();
|
||||
second = second->tokAt(2);
|
||||
if (Token::Match(first->tokAt(2), "%name%| ,|)") && Token::Match(second->tokAt(3), "%name%| ,|)")) {
|
||||
first = first->tokAt(Token::Match(first->tokAt(2), "%name%") ? 2 : 1);
|
||||
second = second->tokAt(Token::Match(second->tokAt(3), "%name%") ? 3 : 2);
|
||||
} else {
|
||||
first = first->next();
|
||||
second = second->tokAt(2);
|
||||
}
|
||||
} else {
|
||||
first = first->tokAt(2);
|
||||
second = second->next();
|
||||
if (Token::Match(second->tokAt(2), "%name%| ,|)") && Token::Match(first->tokAt(3), "%name%| ,|)")) {
|
||||
first = first->tokAt(Token::Match(first->tokAt(3), "%name%") ? 3 : 2);
|
||||
second = second->tokAt(Token::Match(second->tokAt(2), "%name%") ? 2 : 1);
|
||||
} else {
|
||||
first = first->tokAt(2);
|
||||
second = second->next();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -367,6 +367,7 @@ private:
|
|||
TEST_CASE(symboldatabase101);
|
||||
TEST_CASE(symboldatabase102);
|
||||
TEST_CASE(symboldatabase103);
|
||||
TEST_CASE(symboldatabase104);
|
||||
|
||||
TEST_CASE(createSymbolDatabaseFindAllScopes1);
|
||||
TEST_CASE(createSymbolDatabaseFindAllScopes2);
|
||||
|
@ -5075,6 +5076,25 @@ private:
|
|||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void symboldatabase104() { // #11535
|
||||
GET_SYMBOL_DB("struct S {\n"
|
||||
" void f1(char* const c);\n"
|
||||
" void f2(char* const c);\n"
|
||||
" void f3(char* const);\n"
|
||||
" void f4(char* c);\n"
|
||||
" void f5(char* c);\n"
|
||||
" void f6(char*);\n"
|
||||
"};\n"
|
||||
"void S::f1(char* c) {}\n"
|
||||
"void S::f2(char*) {}\n"
|
||||
"void S::f3(char* c) {}\n"
|
||||
"void S::f4(char* const c) {}\n"
|
||||
"void S::f5(char* const) {}\n"
|
||||
"void S::f6(char* const c) {}\n");
|
||||
ASSERT(db != nullptr);
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void createSymbolDatabaseFindAllScopes1() {
|
||||
GET_SYMBOL_DB("void f() { union {int x; char *p;} a={0}; }");
|
||||
ASSERT(db->scopeList.size() == 3);
|
||||
|
|
Loading…
Reference in New Issue