Fixed #9591 (SymbolDatabase: decltype)
This commit is contained in:
parent
e15188ca73
commit
18124fe248
|
@ -3417,6 +3417,10 @@ void Function::addArguments(const SymbolDatabase *symbolDatabase, const Scope *s
|
|||
const Token* nameTok = nullptr;
|
||||
|
||||
do {
|
||||
if (Token::simpleMatch(tok, "decltype (")) {
|
||||
tok = tok->linkAt(1)->next();
|
||||
continue;
|
||||
}
|
||||
if (tok != startTok && !nameTok && Token::Match(tok, "( & %var% ) [")) {
|
||||
nameTok = tok->tokAt(2);
|
||||
endTok = nameTok->previous();
|
||||
|
|
|
@ -219,6 +219,7 @@ private:
|
|||
TEST_CASE(functionArgs13); // #7697
|
||||
TEST_CASE(functionArgs14); // #9055
|
||||
TEST_CASE(functionArgs15); // #7159
|
||||
TEST_CASE(functionArgs16); // #9591
|
||||
|
||||
TEST_CASE(functionImplicitlyVirtual);
|
||||
|
||||
|
@ -2309,6 +2310,21 @@ private:
|
|||
ASSERT_EQUALS(0, method.minArgCount());
|
||||
}
|
||||
|
||||
void functionArgs16() { // #9591
|
||||
const char code[] =
|
||||
"struct A { int var; };\n"
|
||||
"void foo(int x, decltype(A::var) *&p) {}";
|
||||
GET_SYMBOL_DB(code);
|
||||
ASSERT(db);
|
||||
const Scope *scope = db->functionScopes.front();
|
||||
const Function *func = scope->function;
|
||||
ASSERT_EQUALS(2, func->argCount());
|
||||
const Variable *arg2 = func->getArgumentVar(1);
|
||||
ASSERT_EQUALS("p", arg2->name());
|
||||
ASSERT(arg2->isPointer());
|
||||
ASSERT(arg2->isReference());
|
||||
}
|
||||
|
||||
void functionImplicitlyVirtual() {
|
||||
GET_SYMBOL_DB("class base { virtual void f(); };\n"
|
||||
"class derived : base { void f(); };\n"
|
||||
|
|
Loading…
Reference in New Issue