CheckIO: Early return

This commit is contained in:
Daniel Marjamäki 2015-10-05 19:04:29 +02:00
parent 8f6bd7fd0d
commit bc8f1b972e
1 changed files with 105 additions and 103 deletions

View File

@ -1361,9 +1361,12 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings,
, address(false)
, isCPP(_isCPP)
{
if (!tok)
return;
// Use AST type info
// TODO: This is a bailout so that old code is used in simple cases. Remove the old code and always use the AST type.
if (tok && !Token::Match(tok, "&| %str%|%num%|%name% ,|)") && !Token::Match(tok, "%name% [|(|.|<|::|?")) {
if (!Token::Match(tok, "&| %str%|%num%|%name% ,|)") && !Token::Match(tok, "%name% [|(|.|<|::|?")) {
const ValueType *valuetype = tok->argumentType();
if (valuetype && valuetype->type >= ValueType::Type::BOOL && !valuetype->pointer) {
tempToken = new Token(0);
@ -1388,7 +1391,7 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings,
}
}
if (tok) {
if (tok->tokType() == Token::eString) {
typeToken = tok;
return;
@ -1513,7 +1516,6 @@ CheckIO::ArgumentInfo::ArgumentInfo(const Token * tok, const Settings *settings,
return;
}
}
}
}
CheckIO::ArgumentInfo::~ArgumentInfo()