MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / detectSmartPointer

Method detectSmartPointer

lib/library.cpp:1958–1979  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1956}
1957
1958const Library::SmartPointer* Library::detectSmartPointer(const Token* tok, bool withoutStd) const
1959{
1960 if (!tok)
1961 return nullptr;
1962 if (tok->isKeyword())
1963 return nullptr;
1964 std::string typestr = withoutStd ? "std::" : "";
1965 if (tok->str() == "::")
1966 tok = tok->next();
1967 while (Token::Match(tok, "%name% ::")) {
1968 typestr += tok->str();
1969 typestr += "::";
1970 tok = tok->tokAt(2);
1971 }
1972 if (tok && tok->isName()) {
1973 typestr += tok->str();
1974 }
1975 auto it = mData->mSmartPointers.find(typestr);
1976 if (it == mData->mSmartPointers.end())
1977 return nullptr;
1978 return &it->second;
1979}
1980
1981const Library::Container * getLibraryContainer(const Token * tok)
1982{

Callers 5

parsedeclFunction · 0.80
isStdSmartPointerFunction · 0.80
smartpointerMethod · 0.80

Calls 6

nextMethod · 0.80
isKeywordMethod · 0.45
strMethod · 0.45
tokAtMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by 1

smartpointerMethod · 0.64