@@ -213,86 +213,6 @@ static void changePossibleToKnown(std::list<ValueFlow::Value>& values, int indir
213213 }
214214}
215215
216- static void setValueUpperBound (ValueFlow::Value& value, bool upper)
217- {
218- if (upper)
219- value.bound = ValueFlow::Value::Bound::Upper;
220- else
221- value.bound = ValueFlow::Value::Bound::Lower;
222- }
223-
224- static void setValueBound (ValueFlow::Value& value, const Token* tok, bool invert)
225- {
226- if (Token::Match (tok, " <|<=" )) {
227- setValueUpperBound (value, !invert);
228- } else if (Token::Match (tok, " >|>=" )) {
229- setValueUpperBound (value, invert);
230- }
231- }
232-
233- static void setConditionalValues (const Token *tok,
234- bool invert,
235- MathLib::bigint value,
236- ValueFlow::Value &true_value,
237- ValueFlow::Value &false_value)
238- {
239- if (Token::Match (tok, " ==|!=|>=|<=" )) {
240- true_value = ValueFlow::Value{tok, value};
241- const char * greaterThan = " >=" ;
242- const char * lessThan = " <=" ;
243- if (invert)
244- std::swap (greaterThan, lessThan);
245- if (Token::Match (tok, greaterThan)) {
246- false_value = ValueFlow::Value{tok, value - 1 };
247- } else if (Token::Match (tok, lessThan)) {
248- false_value = ValueFlow::Value{tok, value + 1 };
249- } else {
250- false_value = ValueFlow::Value{tok, value};
251- }
252- } else {
253- const char * greaterThan = " >" ;
254- const char * lessThan = " <" ;
255- if (invert)
256- std::swap (greaterThan, lessThan);
257- if (Token::Match (tok, greaterThan)) {
258- true_value = ValueFlow::Value{tok, value + 1 };
259- false_value = ValueFlow::Value{tok, value};
260- } else if (Token::Match (tok, lessThan)) {
261- true_value = ValueFlow::Value{tok, value - 1 };
262- false_value = ValueFlow::Value{tok, value};
263- }
264- }
265- setValueBound (true_value, tok, invert);
266- setValueBound (false_value, tok, !invert);
267- }
268-
269- static bool isSaturated (MathLib::bigint value)
270- {
271- return value == std::numeric_limits<MathLib::bigint>::max () || value == std::numeric_limits<MathLib::bigint>::min ();
272- }
273-
274- static const Token *parseCompareInt (const Token *tok, ValueFlow::Value &true_value, ValueFlow::Value &false_value)
275- {
276- if (!tok->astOperand1 () || !tok->astOperand2 ())
277- return nullptr ;
278- if (Token::Match (tok, " %comp%" )) {
279- if (tok->astOperand1 ()->hasKnownIntValue ()) {
280- MathLib::bigint value = tok->astOperand1 ()->values ().front ().intvalue ;
281- if (isSaturated (value))
282- return nullptr ;
283- setConditionalValues (tok, true , value, true_value, false_value);
284- return tok->astOperand2 ();
285- } else if (tok->astOperand2 ()->hasKnownIntValue ()) {
286- MathLib::bigint value = tok->astOperand2 ()->values ().front ().intvalue ;
287- if (isSaturated (value))
288- return nullptr ;
289- setConditionalValues (tok, false , value, true_value, false_value);
290- return tok->astOperand1 ();
291- }
292- }
293- return nullptr ;
294- }
295-
296216/* *
297217 * Should value be skipped because it's hidden inside && || or ?: expression.
298218 * Example: ((x!=NULL) && (*x == 123))
@@ -1115,6 +1035,7 @@ static bool getMinMaxValues(const ValueType *vt, const Platform &platform, MathL
11151035 return true ;
11161036}
11171037
1038+ /*
11181039static bool getMinMaxValues(const std::string &typestr, const Settings &settings, MathLib::bigint &minvalue, MathLib::bigint &maxvalue)
11191040{
11201041 TokenList typeTokens(&settings);
@@ -1126,6 +1047,7 @@ static bool getMinMaxValues(const std::string &typestr, const Settings &settings
11261047 const ValueType &vt = ValueType::parseDecl(typeTokens.front(), settings);
11271048 return getMinMaxValues(&vt, settings.platform, minvalue, maxvalue);
11281049}
1050+ */
11291051
11301052static void valueFlowEnumValue (SymbolDatabase & symboldatabase, const Settings & settings)
11311053{
@@ -4614,13 +4536,13 @@ static void valueFlowFunctionDefaultParameter(TokenList& tokenlist, const Symbol
46144536 }
46154537}
46164538
4539+ // FIXME: execute
4540+ /*
46174541static bool isKnown(const Token * tok)
46184542{
46194543 return tok && tok->hasKnownIntValue();
46204544}
46214545
4622- // FIXME: execute
4623- /*
46244546static void valueFlowFunctionReturn(TokenList& tokenlist, ErrorLogger *errorLogger, const Settings& settings)
46254547{
46264548 for (Token *tok = tokenlist.back(); tok; tok = tok->previous()) {
0 commit comments