This commit is contained in:
parent
d608bec414
commit
e8b9cd64fc
|
@ -1141,30 +1141,33 @@ const Library::Container* Library::detectContainerInternal(const Token* typeStar
|
||||||
if (container.startPattern.empty())
|
if (container.startPattern.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!Token::Match(typeStart, container.startPattern2.c_str()))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// If endPattern is undefined, it will always match, but itEndPattern has to be defined.
|
// If endPattern is undefined, it will always match, but itEndPattern has to be defined.
|
||||||
if (detect != IteratorOnly && container.endPattern.empty()) {
|
if (detect != IteratorOnly && container.endPattern.empty()) {
|
||||||
|
if (!Token::Match(typeStart, container.startPattern2.c_str()))
|
||||||
|
continue;
|
||||||
|
|
||||||
if (isIterator)
|
if (isIterator)
|
||||||
*isIterator = false;
|
*isIterator = false;
|
||||||
return &container;
|
return &container;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const Token* tok = typeStart; tok && !tok->varId(); tok = tok->next()) {
|
for (const Token* tok = typeStart; tok && !tok->varId(); tok = tok->next()) {
|
||||||
if (tok->link()) {
|
if (!tok->link())
|
||||||
if (detect != ContainerOnly && Token::Match(tok->link(), container.itEndPattern.c_str())) {
|
continue;
|
||||||
if (isIterator)
|
|
||||||
*isIterator = true;
|
const bool matchedStartPattern = Token::Match(typeStart, container.startPattern2.c_str());
|
||||||
return &container;
|
|
||||||
}
|
if (detect != ContainerOnly && matchedStartPattern && Token::Match(tok->link(), container.itEndPattern.c_str())) {
|
||||||
if (detect != IteratorOnly && Token::Match(tok->link(), container.endPattern.c_str())) {
|
if (isIterator)
|
||||||
if (isIterator)
|
*isIterator = true;
|
||||||
*isIterator = false;
|
return &container;
|
||||||
return &container;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
if (detect != IteratorOnly && matchedStartPattern && Token::Match(tok->link(), container.endPattern.c_str())) {
|
||||||
|
if (isIterator)
|
||||||
|
*isIterator = false;
|
||||||
|
return &container;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
Loading…
Reference in New Issue