Added CPPCHECKLIB to two clases and reverted 30a942af0b

This commit is contained in:
PKEuS 2015-10-07 13:38:34 +02:00
parent f5d9ba9cf3
commit b634a76fcb
3 changed files with 32 additions and 29 deletions

View File

@ -3769,3 +3769,32 @@ void SymbolDatabase::setValueTypeInTokenList(Token *tokens)
}
}
}
std::string ValueType::str() const
{
std::string ret;
if (isIntegral()) {
if (sign == SIGNED)
ret = "signed ";
else if (sign == UNSIGNED)
ret = "unsigned ";
if (type == BOOL)
ret += "bool";
else if (type == CHAR)
ret += "char";
else if (type == SHORT)
ret += "short";
else if (type == INT)
ret += "int";
else if (type == LONG)
ret += "long";
else if (type == LONGLONG)
ret += "long long";
} else if (type == FLOAT)
ret = "float";
else if (type == DOUBLE)
ret = "double";
for (unsigned int p = 0; p < pointer; p++)
ret += "*";
return ret;
}

View File

@ -1039,7 +1039,7 @@ private:
};
/** Value type */
class ValueType {
class CPPCHECKLIB ValueType {
public:
enum Sign {UNKNOWN_SIGN, SIGNED, UNSIGNED} sign;
enum Type {UNKNOWN_TYPE, NONSTD, BOOL, CHAR, SHORT, INT, LONG, LONGLONG, FLOAT, DOUBLE} type;
@ -1052,33 +1052,7 @@ public:
return (type >= ValueType::Type::BOOL && type <= ValueType::Type::LONGLONG);
}
std::string str() const {
std::string ret;
if (isIntegral()) {
if (sign == SIGNED)
ret = "signed ";
else if (sign == UNSIGNED)
ret = "unsigned ";
if (type == BOOL)
ret += "bool";
else if (type == CHAR)
ret += "char";
else if (type == SHORT)
ret += "short";
else if (type == INT)
ret += "int";
else if (type == LONG)
ret += "long";
else if (type == LONGLONG)
ret += "long long";
} else if (type == FLOAT)
ret = "float";
else if (type == DOUBLE)
ret = "double";
for (unsigned int p = 0; p < pointer; p++)
ret += "*";
return ret;
}
std::string str() const;
};

View File

@ -30,7 +30,7 @@ class ErrorLogger;
class Settings;
namespace ValueFlow {
class Value {
class CPPCHECKLIB Value {
public:
explicit Value(long long val = 0) : intvalue(val), tokvalue(nullptr), varvalue(val), condition(0), varId(0U), conditional(false), inconclusive(false), defaultArg(false), valueKind(ValueKind::Possible) {}
Value(const Token *c, long long val) : intvalue(val), tokvalue(nullptr), varvalue(val), condition(c), varId(0U), conditional(false), inconclusive(false), defaultArg(false), valueKind(ValueKind::Possible) {}