Fix #14660 Handle reverse conditions in isOppositeCond function#8408
Fix #14660 Handle reverse conditions in isOppositeCond function#8408francois-berder wants to merge 3 commits intodanmar:mainfrom
Conversation
Signed-off-by: Francois Berder <fberder@outlook.fr>
lib/astutils.cpp
Outdated
| static bool isZeroBoundCond(const Token * const cond, bool reverse) | ||
| { | ||
| if (cond == nullptr) | ||
| if (cond == nullptr || cond->astOperand1() == nullptr || cond->astOperand2() == nullptr) |
There was a problem hiding this comment.
| if (cond == nullptr || cond->astOperand1() == nullptr || cond->astOperand2() == nullptr) | |
| if (cond == nullptr || !cond->isBinaryOp()) |
lib/astutils.cpp
Outdated
| return !isZero; | ||
| if (cond->str() == ">") | ||
|
|
||
| if ((reverse && !cond->astOperand1()->hasKnownIntValue()) || (!reverse && !cond->astOperand2()->hasKnownIntValue())) |
There was a problem hiding this comment.
hmm an alternative that would lead to less "hard coding" would be:
std::string cmp = cond->str();
if (reverse && cmp[0] == '>')
cmp[0] = '<';
else if (reverse && cmp[0] == '<')
cmp[0] = '>';
const Token* const op1 = reverse ? cond->astOperand1() : cond->astOperand2();
const Token* const op2 = reverse ? cond->astOperand2() : cond->astOperand1();
....
|
Please file a ticket for this. |
not sure if you have a trac account. let us know if you want us to file a ticket for you.. |
Indeed, I do not have a trac account and I cannot create one myself so please file a ticket for me. |
|
|
Let me know if you want to squash the commits and include a reference to the ticket number in the commit message. |
|
We always squash, and the PR title becomes the commit message, so it's all good. |



No description provided.