Fixed #7978 (ValueType: container type not set properly)
This commit is contained in:
parent
fee86b9684
commit
fd2651909c
|
@ -4802,12 +4802,16 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
|
|||
valuetype->sign = ValueType::Sign::UNSIGNED;
|
||||
if (type->str() == "const")
|
||||
valuetype->constness |= (1 << (valuetype->pointer - pointer0));
|
||||
else if (Token::Match(type, "%name% :: %name%")) {
|
||||
const Library::Container *container = settings->library.detectContainer(type);
|
||||
if (container) {
|
||||
else if (const Library::Container *container = settings->library.detectContainer(type)) {
|
||||
valuetype->type = ValueType::Type::CONTAINER;
|
||||
valuetype->container = container;
|
||||
} else {
|
||||
while (Token::Match(type, "%name%|::|<")) {
|
||||
if (type->str() == "<" && type->link())
|
||||
type = type->link();
|
||||
type = type->next();
|
||||
}
|
||||
continue;
|
||||
} else if (Token::Match(type, "%name% :: %name%")) {
|
||||
std::string typestr;
|
||||
const Token *end = type;
|
||||
while (Token::Match(end, "%name% :: %name%")) {
|
||||
|
@ -4817,7 +4821,6 @@ static const Token * parsedecl(const Token *type, ValueType * const valuetype, V
|
|||
typestr += end->str();
|
||||
if (valuetype->fromLibraryType(typestr, settings))
|
||||
type = end;
|
||||
}
|
||||
} else if (ValueType::Type::UNKNOWN_TYPE != ValueType::typeFromString(type->str(), type->isLong()))
|
||||
valuetype->type = ValueType::typeFromString(type->str(), type->isLong());
|
||||
else if (type->str() == "auto") {
|
||||
|
|
|
@ -4438,6 +4438,7 @@ private:
|
|||
c.startPattern = "C";
|
||||
sC.library.containers["C"] = c;
|
||||
ASSERT_EQUALS("container(C) *", typeOf("C*c=new C;","new","test.cpp",&sC));
|
||||
ASSERT_EQUALS("container(C) *", typeOf("x=(C*)c;","(","test.cpp",&sC));
|
||||
}
|
||||
|
||||
// new
|
||||
|
|
Loading…
Reference in New Issue