File tree Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Expand file tree Collapse file tree 1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -11374,11 +11374,27 @@ static void AnalyzeComparison(Sema &S, BinaryOperator *E) {
11374
11374
LHS->getIntegerConstantExpr(S.Context);
11375
11375
11376
11376
// We don't care about expressions whose result is a constant.
11377
- if (RHSValue && LHSValue)
11377
+ if (RHSValue && LHSValue) {
11378
+ auto *LHSCE = ConstantExpr::Create(S.Context, LHS, APValue(*LHSValue));
11379
+ auto *RHSCE = ConstantExpr::Create(S.Context, RHS, APValue(*RHSValue));
11380
+ E->setLHS(LHSCE);
11381
+ E->setRHS(RHSCE);
11378
11382
return AnalyzeImpConvsInComparison(S, E);
11383
+ }
11379
11384
11380
11385
// We only care about expressions where just one side is literal
11381
11386
if ((bool)RHSValue ^ (bool)LHSValue) {
11387
+
11388
+ if (LHSValue) {
11389
+ auto *LHSCE = ConstantExpr::Create(S.Context, LHS, APValue(*LHSValue));
11390
+ E->setLHS(LHSCE);
11391
+ LHS = LHSCE;
11392
+ } else if (RHSValue) {
11393
+ auto *RHSCE = ConstantExpr::Create(S.Context, RHS, APValue(*RHSValue));
11394
+ E->setRHS(RHSCE);
11395
+ RHS = RHSCE;
11396
+ }
11397
+
11382
11398
// Is the constant on the RHS or LHS?
11383
11399
const bool RhsConstant = (bool)RHSValue;
11384
11400
Expr *Const = RhsConstant ? RHS : LHS;
You can’t perform that action at this time.
0 commit comments