AST: Use AST type in astIsSignedChar

This commit is contained in:
Daniel Marjamäki 2015-10-06 07:13:41 +02:00
parent b77203a277
commit 2034706033
1 changed files with 1 additions and 12 deletions

View File

@ -36,18 +36,7 @@ static bool isSignedChar(const Variable* var)
bool astIsSignedChar(const Token *tok)
{
if (!tok)
return false;
if (tok->str() == "*" && tok->astOperand1() && !tok->astOperand2()) {
const Variable *var = tok->astOperand1()->variable();
if (!var || !var->isPointer())
return false;
const Token *type = var->typeStartToken();
while (type && type->str() == "const")
type = type->next();
return (type && type->str() == "char" && !type->isUnsigned());
}
return isSignedChar(tok->variable());
return tok && tok->valueType() && tok->valueType()->sign != ValueType::Sign::UNSIGNED && tok->valueType()->type == ValueType::Type::CHAR && tok->valueType()->pointer == 0U;
}
bool astIsIntegral(const Token *tok, bool unknown)