52 :
Check(myName(), tokenizer, settings, errorLogger) {}
66 void checkTooBigBitwiseShift();
69 void checkIntegerOverflow();
72 void checkSignConversion();
78 void checkFloatToIntegerOverflow();
79 void checkFloatToIntegerOverflow(
const Token *tok,
const ValueType *vtint,
const ValueType *vtfloat,
const std::list<ValueFlow::Value> &floatValues);
85 void signConversionError(
const Token *tok,
const ValueFlow::Value *negativeValue,
const bool constvalue);
91 CheckType c(
nullptr, settings, errorLogger);
109 return "Type checks\n"
110 "- bitwise shift by too many bits (only enabled when --platform is used)\n"
111 "- signed integer overflow (only enabled when --platform is used)\n"
112 "- dangerous sign conversion, when signed value can be negative\n"
113 "- possible loss of information when assigning int result to long variable\n"
114 "- possible loss of information when returning int result as long return value\n"
115 "- float conversion overflow\n";
void getErrorMessages(ErrorLogger *errorLogger, const Settings *settings) const override
get error messages
void tooBigSignedBitwiseShiftError(const Token *tok, int lhsbits, const ValueFlow::Value &rhsbits)
CheckType(const Tokenizer *tokenizer, const Settings *settings, ErrorLogger *errorLogger)
This constructor is used when running checks.
void signConversionError(const Token *tok, const ValueFlow::Value *negativeValue, const bool constvalue)
CheckType()
This constructor is used when registering the CheckClass.
void checkFloatToIntegerOverflow()
Check for float to integer overflow
void checkIntegerOverflow()
Check for integer overflow
void longCastAssignError(const Token *tok, const ValueType *src=nullptr, const ValueType *tgt=nullptr)
void checkSignConversion()
Check for dangerous sign conversion
void runChecks(const Tokenizer &tokenizer, ErrorLogger *errorLogger) override
Run checks against the normal token list.
void integerOverflowError(const Token *tok, const ValueFlow::Value &value)
std::string classInfo() const override
get information about this class, used to generate documentation
static std::string myName()
void floatToIntegerOverflowError(const Token *tok, const ValueFlow::Value &value)
void checkLongCast()
Check for implicit long cast of int result
void longCastReturnError(const Token *tok, const ValueType *src=nullptr, const ValueType *tgt=nullptr)
void checkTooBigBitwiseShift()
Check for bitwise shift with too big right operand
void tooBigBitwiseShiftError(const Token *tok, int lhsbits, const ValueFlow::Value &rhsbits)
Interface class that cppcheck uses to communicate with the checks.
This is an interface, which the class responsible of error logging should implement.
This is just a container for general settings so that we don't need to pass individual values to func...
The token list that the TokenList generates is a linked-list of this class.
The main purpose is to tokenize the source code.
const Settings & getSettings() const
enum ValueFlow::Value::ValueType valueType
double floatValue
float value