| 1897 | } |
| 1898 | |
| 1899 | const Token* Library::getContainerFromYield(const Token* tok, Library::Container::Yield yield) const |
| 1900 | { |
| 1901 | if (!tok) |
| 1902 | return nullptr; |
| 1903 | if (Token::Match(tok->tokAt(-2), ". %name% (")) { |
| 1904 | const Token* containerTok = tok->tokAt(-2)->astOperand1(); |
| 1905 | if (!astIsContainer(containerTok)) |
| 1906 | return nullptr; |
| 1907 | if (containerTok->valueType()->container && |
| 1908 | containerTok->valueType()->container->getYield(tok->strAt(-1)) == yield) |
| 1909 | return containerTok; |
| 1910 | if (yield == Library::Container::Yield::EMPTY && Token::simpleMatch(tok->tokAt(-1), "empty ( )")) |
| 1911 | return containerTok; |
| 1912 | if (yield == Library::Container::Yield::SIZE && Token::Match(tok->tokAt(-1), "size|length ( )")) |
| 1913 | return containerTok; |
| 1914 | } else if (Token::Match(tok->previous(), "%name% (")) { |
| 1915 | if (const Library::Function* f = this->getFunction(tok->previous())) { |
| 1916 | if (f->containerYield == yield) { |
| 1917 | return tok->astOperand2(); |
| 1918 | } |
| 1919 | } |
| 1920 | } |
| 1921 | return nullptr; |
| 1922 | } |
| 1923 | |
| 1924 | // cppcheck-suppress unusedFunction |
| 1925 | const Token* Library::getContainerFromAction(const Token* tok, Library::Container::Action action) const |
no test coverage detected