File tree Expand file tree Collapse file tree 2 files changed +9
-1
lines changed
Expand file tree Collapse file tree 2 files changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -619,6 +619,7 @@ Library::Error Library::load(const tinyxml2::XMLDocument &doc)
619619 container.startPattern2 = startPattern;
620620 if (!endsWith (container.startPattern , ' <' ))
621621 container.startPattern2 += " !!::" ;
622+ container.startPatternHasStd = startsWith (container.startPattern2 , " std :: " );
622623 }
623624 const char * const endPattern = node->Attribute (" endPattern" );
624625 if (endPattern)
@@ -1395,12 +1396,18 @@ const Library::Container* Library::detectContainerInternal(const Token* const ty
13951396 break ;
13961397 }
13971398
1399+ const bool hasScope = typeStart->strAt (1 ) == " ::" ;
1400+ const bool bailIfHasStd = !withoutStd && !hasScope;
1401+
13981402 for (const std::pair<const std::string, Library::Container> & c : mData ->mContainers ) {
13991403 const Container& container = c.second ;
14001404 if (container.startPattern .empty ())
14011405 continue ;
14021406
1403- const int offset = (withoutStd && startsWith (container.startPattern2 , " std :: " )) ? 7 : 0 ;
1407+ if (bailIfHasStd && container.startPatternHasStd )
1408+ continue ;
1409+
1410+ const int offset = (withoutStd && container.startPatternHasStd ) ? 7 : 0 ;
14041411
14051412 // If endPattern is undefined, it will always match, but itEndPattern has to be defined.
14061413 if (detect != IteratorOnly && container.endPattern .empty ()) {
Original file line number Diff line number Diff line change @@ -239,6 +239,7 @@ class CPPCHECKLIB Library {
239239 bool unstableErase{};
240240 bool unstableInsert{};
241241 bool view{};
242+ bool startPatternHasStd{};
242243
243244 Action getAction (const std::string& function) const {
244245 const auto i = utils::as_const (functions).find (function);
You can’t perform that action at this time.
0 commit comments