Renamed private member defaultSignedness

This commit is contained in:
Daniel Marjamäki 2018-06-16 23:25:35 +02:00
parent 678e3271d4
commit 306b2a9810
2 changed files with 15 additions and 15 deletions

View File

@ -41,11 +41,11 @@ SymbolDatabase::SymbolDatabase(const Tokenizer *tokenizer, const Settings *setti
cpp = isCPP(); cpp = isCPP();
if (mSettings->defaultSign == 's' || mSettings->defaultSign == 'S') if (mSettings->defaultSign == 's' || mSettings->defaultSign == 'S')
defaultSignedness = ValueType::SIGNED; mDefaultSignedness = ValueType::SIGNED;
else if (mSettings->defaultSign == 'u' || mSettings->defaultSign == 'U') else if (mSettings->defaultSign == 'u' || mSettings->defaultSign == 'U')
defaultSignedness = ValueType::UNSIGNED; mDefaultSignedness = ValueType::UNSIGNED;
else else
defaultSignedness = ValueType::UNKNOWN_SIGN; mDefaultSignedness = ValueType::UNKNOWN_SIGN;
createSymbolDatabaseFindAllScopes(); createSymbolDatabaseFindAllScopes();
createSymbolDatabaseClassInfo(); createSymbolDatabaseClassInfo();
@ -4792,7 +4792,7 @@ void SymbolDatabase::setValueType(Token *tok, const Variable &var)
valuetype.bits = var.nameToken()->bits(); valuetype.bits = var.nameToken()->bits();
valuetype.pointer = var.dimensions().size(); valuetype.pointer = var.dimensions().size();
valuetype.typeScope = var.typeScope(); valuetype.typeScope = var.typeScope();
if (parsedecl(var.typeStartToken(), &valuetype, defaultSignedness, mSettings)) if (parsedecl(var.typeStartToken(), &valuetype, mDefaultSignedness, mSettings))
setValueType(tok, valuetype); setValueType(tok, valuetype);
} }
@ -4812,7 +4812,7 @@ void SymbolDatabase::setValueType(Token *tok, const Enumerator &enumerator)
else if (type->isUnsigned()) else if (type->isUnsigned())
valuetype.sign = ValueType::Sign::UNSIGNED; valuetype.sign = ValueType::Sign::UNSIGNED;
else if (valuetype.type == ValueType::Type::CHAR) else if (valuetype.type == ValueType::Type::CHAR)
valuetype.sign = defaultSignedness; valuetype.sign = mDefaultSignedness;
else else
valuetype.sign = ValueType::Sign::SIGNED; valuetype.sign = ValueType::Sign::SIGNED;
} }
@ -4977,7 +4977,7 @@ void SymbolDatabase::setValueType(Token *tok, const ValueType &valuetype)
// TODO: Get type better // TODO: Get type better
if (Token::Match(typeStart, "std :: %type% < %type% *| *| >")) { if (Token::Match(typeStart, "std :: %type% < %type% *| *| >")) {
ValueType autovt; ValueType autovt;
if (parsedecl(typeStart->tokAt(4), &autovt, defaultSignedness, mSettings)) { if (parsedecl(typeStart->tokAt(4), &autovt, mDefaultSignedness, mSettings)) {
setValueType(autoToken, autovt); setValueType(autoToken, autovt);
setAutoTokenProperties(autoToken); setAutoTokenProperties(autoToken);
ValueType varvt(autovt); ValueType varvt(autovt);
@ -5000,7 +5000,7 @@ void SymbolDatabase::setValueType(Token *tok, const ValueType &valuetype)
if (vt1 && vt1->containerTypeToken && parent->str() == "[") { if (vt1 && vt1->containerTypeToken && parent->str() == "[") {
ValueType vtParent; ValueType vtParent;
if (parsedecl(vt1->containerTypeToken, &vtParent, defaultSignedness, mSettings)) { if (parsedecl(vt1->containerTypeToken, &vtParent, mDefaultSignedness, mSettings)) {
setValueType(parent, vtParent); setValueType(parent, vtParent);
return; return;
} }
@ -5275,7 +5275,7 @@ void SymbolDatabase::setValueTypeInTokenList()
const Function *function = getOperatorFunction(tok); const Function *function = getOperatorFunction(tok);
if (function) { if (function) {
ValueType vt; ValueType vt;
parsedecl(function->retDef, &vt, defaultSignedness, mSettings); parsedecl(function->retDef, &vt, mDefaultSignedness, mSettings);
setValueType(tok, vt); setValueType(tok, vt);
continue; continue;
} }
@ -5294,21 +5294,21 @@ void SymbolDatabase::setValueTypeInTokenList()
// cast // cast
if (!tok->astOperand2() && Token::Match(tok, "( %name%")) { if (!tok->astOperand2() && Token::Match(tok, "( %name%")) {
ValueType valuetype; ValueType valuetype;
if (Token::simpleMatch(parsedecl(tok->next(), &valuetype, defaultSignedness, mSettings), ")")) if (Token::simpleMatch(parsedecl(tok->next(), &valuetype, mDefaultSignedness, mSettings), ")"))
setValueType(tok, valuetype); setValueType(tok, valuetype);
} }
// C++ cast // C++ cast
if (tok->astOperand2() && Token::Match(tok->astOperand1(), "static_cast|const_cast|dynamic_cast|reinterpret_cast < %name%") && tok->astOperand1()->linkAt(1)) { if (tok->astOperand2() && Token::Match(tok->astOperand1(), "static_cast|const_cast|dynamic_cast|reinterpret_cast < %name%") && tok->astOperand1()->linkAt(1)) {
ValueType valuetype; ValueType valuetype;
if (Token::simpleMatch(parsedecl(tok->astOperand1()->tokAt(2), &valuetype, defaultSignedness, mSettings), ">")) if (Token::simpleMatch(parsedecl(tok->astOperand1()->tokAt(2), &valuetype, mDefaultSignedness, mSettings), ">"))
setValueType(tok, valuetype); setValueType(tok, valuetype);
} }
// function // function
else if (tok->previous() && tok->previous()->function() && tok->previous()->function()->retDef) { else if (tok->previous() && tok->previous()->function() && tok->previous()->function()->retDef) {
ValueType valuetype; ValueType valuetype;
if (parsedecl(tok->previous()->function()->retDef, &valuetype, defaultSignedness, mSettings)) if (parsedecl(tok->previous()->function()->retDef, &valuetype, mDefaultSignedness, mSettings))
setValueType(tok, valuetype); setValueType(tok, valuetype);
} }
@ -5320,7 +5320,7 @@ void SymbolDatabase::setValueTypeInTokenList()
if (Token::Match(tok, "( %type% %type%| *| *| )")) { if (Token::Match(tok, "( %type% %type%| *| *| )")) {
ValueType vt; ValueType vt;
if (parsedecl(tok->next(), &vt, defaultSignedness, mSettings)) { if (parsedecl(tok->next(), &vt, mDefaultSignedness, mSettings)) {
setValueType(tok->next(), vt); setValueType(tok->next(), vt);
} }
} }
@ -5371,7 +5371,7 @@ void SymbolDatabase::setValueTypeInTokenList()
ValueType vt; ValueType vt;
assert(tokenList.front()); assert(tokenList.front());
tokenList.simplifyStdType(); tokenList.simplifyStdType();
if (parsedecl(tokenList.front(), &vt, defaultSignedness, mSettings)) { if (parsedecl(tokenList.front(), &vt, mDefaultSignedness, mSettings)) {
setValueType(tok, vt); setValueType(tok, vt);
} }
} }
@ -5416,7 +5416,7 @@ void SymbolDatabase::setValueTypeInTokenList()
else if (typeTok->isSigned()) else if (typeTok->isSigned())
vt.sign = ValueType::Sign::SIGNED; vt.sign = ValueType::Sign::SIGNED;
if (vt.sign == ValueType::Sign::UNKNOWN_SIGN && vt.isIntegral()) if (vt.sign == ValueType::Sign::UNKNOWN_SIGN && vt.isIntegral())
vt.sign = (vt.type == ValueType::Type::CHAR) ? defaultSignedness : ValueType::Sign::SIGNED; vt.sign = (vt.type == ValueType::Type::CHAR) ? mDefaultSignedness : ValueType::Sign::SIGNED;
} }
setValueType(tok, vt); setValueType(tok, vt);
} }

View File

@ -1249,7 +1249,7 @@ private:
std::list<Type> mBlankTypes; std::list<Type> mBlankTypes;
bool cpp; bool cpp;
ValueType::Sign defaultSignedness; ValueType::Sign mDefaultSignedness;
/** "negative cache" list of tokens that we find are not enumeration values */ /** "negative cache" list of tokens that we find are not enumeration values */
mutable std::set<std::string> tokensThatAreNotEnumeratorValues; mutable std::set<std::string> tokensThatAreNotEnumeratorValues;