This commit is contained in:
parent
c79d859f8b
commit
5791561a45
|
@ -6379,12 +6379,13 @@ void SymbolDatabase::setValueType(Token* tok, const ValueType& valuetype, Source
|
||||||
const Token *smartPointerTypeTok = vt2->containerTypeToken;
|
const Token *smartPointerTypeTok = vt2->containerTypeToken;
|
||||||
while (Token::Match(smartPointerTypeTok, "%name%|::"))
|
while (Token::Match(smartPointerTypeTok, "%name%|::"))
|
||||||
smartPointerTypeTok = smartPointerTypeTok->next();
|
smartPointerTypeTok = smartPointerTypeTok->next();
|
||||||
if (Token::Match(smartPointerTypeTok, "< %name% > >") && smartPointerTypeTok->next()->type()) {
|
if (Token::simpleMatch(smartPointerTypeTok, "<")) {
|
||||||
|
if ((templateArgType = findTypeInNested(smartPointerTypeTok->next(), tok->scope()))) {
|
||||||
setType = true;
|
setType = true;
|
||||||
templateArgType = smartPointerTypeTok->next()->type();
|
|
||||||
autovt.smartPointerType = templateArgType;
|
autovt.smartPointerType = templateArgType;
|
||||||
autovt.type = ValueType::Type::NONSTD;
|
autovt.type = ValueType::Type::NONSTD;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (parsedecl(vt2->containerTypeToken, &autovt, mDefaultSignedness, mSettings, mIsCpp)) {
|
} else if (parsedecl(vt2->containerTypeToken, &autovt, mDefaultSignedness, mSettings, mIsCpp)) {
|
||||||
setType = true;
|
setType = true;
|
||||||
templateArgType = vt2->containerTypeToken->type();
|
templateArgType = vt2->containerTypeToken->type();
|
||||||
|
|
|
@ -8223,6 +8223,24 @@ private:
|
||||||
ASSERT(tok && tok->valueType());
|
ASSERT(tok && tok->valueType());
|
||||||
ASSERT_EQUALS("iterator(std :: vector <)", tok->valueType()->str());
|
ASSERT_EQUALS("iterator(std :: vector <)", tok->valueType()->str());
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
GET_SYMBOL_DB("struct S {\n"
|
||||||
|
" S() {}\n"
|
||||||
|
" std::vector<std::shared_ptr<S>> v;\n"
|
||||||
|
" void f(int i) const;\n"
|
||||||
|
"};\n"
|
||||||
|
"void S::f(int i) const {\n"
|
||||||
|
" for (const auto& c : v)\n"
|
||||||
|
" c->f(i);\n"
|
||||||
|
"}\n");
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
|
||||||
|
const Token* tok = tokenizer.tokens();
|
||||||
|
tok = Token::findsimplematch(tok, "auto");
|
||||||
|
ASSERT(tok && tok->valueType() && tok->scope() && tok->scope()->functionOf);
|
||||||
|
const Type* smpType = tok->valueType()->smartPointerType;
|
||||||
|
ASSERT(smpType && smpType == tok->scope()->functionOf->definedType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueTypeThis() {
|
void valueTypeThis() {
|
||||||
|
|
Loading…
Reference in New Issue