Skip to content

Commit ec9415e

Browse files
committed
refs #10663 - bail out on some impossible matches early in Library::detectContainerInternal()
1 parent 3a99f41 commit ec9415e

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/library.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1395,12 +1395,18 @@ const Library::Container* Library::detectContainerInternal(const Token* const ty
13951395
break;
13961396
}
13971397

1398+
const bool hasScope = typeStart->strAt(1) == "::";
1399+
13981400
for (const std::pair<const std::string, Library::Container> & c : mData->mContainers) {
13991401
const Container& container = c.second;
14001402
if (container.startPattern.empty())
14011403
continue;
14021404

1403-
const int offset = (withoutStd && startsWith(container.startPattern2, "std :: ")) ? 7 : 0;
1405+
const bool startsWithStd = startsWith(container.startPattern2, "std :: ");
1406+
if (startsWithStd && !withoutStd && !hasScope)
1407+
continue;
1408+
1409+
const int offset = (withoutStd && startsWithStd) ? 7 : 0;
14041410

14051411
// If endPattern is undefined, it will always match, but itEndPattern has to be defined.
14061412
if (detect != IteratorOnly && container.endPattern.empty()) {

0 commit comments

Comments
 (0)