C++: Fix IR generation for the comma operator

This commit is contained in:
Jeroen Ketema
2023-08-04 15:01:21 +02:00
parent 0fceecee6d
commit 5036135f01
2 changed files with 7 additions and 3 deletions

View File

@@ -361,8 +361,12 @@ predicate ignoreLoad(Expr expr) {
or
expr instanceof FunctionAccess
or
// The load is duplicated from the operand.
expr instanceof ParenthesisExpr
or
// The load is duplicated from the right operand.
expr instanceof CommaExpr
or
expr.(PointerDereferenceExpr).getOperand().getFullyConverted().getType().getUnspecifiedType()
instanceof FunctionPointerType
or

View File

@@ -15504,7 +15504,7 @@ ir.cpp:
# 2028| ValueCategory = lvalue
# 2028| getRValue(): [ConditionalExpr] ... ? ... : ...
# 2028| Type = [IntType] unsigned int
# 2028| ValueCategory = prvalue
# 2028| ValueCategory = prvalue(load)
# 2028| getCondition(): [LTExpr] ... < ...
# 2028| Type = [BoolType] bool
# 2028| ValueCategory = prvalue
@@ -15522,7 +15522,7 @@ ir.cpp:
# 2028| ValueCategory = prvalue
# 2029| getThen(): [CommaExpr] ... , ...
# 2029| Type = [IntType] unsigned int
# 2029| ValueCategory = prvalue
# 2029| ValueCategory = prvalue(load)
# 2029| getLeftOperand(): [FunctionCall] call to CommaTestHelper
# 2029| Type = [VoidType] void
# 2029| ValueCategory = prvalue
@@ -15547,7 +15547,7 @@ ir.cpp:
# 2030| ValueCategory = prvalue
# 2029| getThen().getFullyConverted(): [ParenthesisExpr] (...)
# 2029| Type = [IntType] unsigned int
# 2029| ValueCategory = prvalue
# 2029| ValueCategory = prvalue(load)
# 2030| getElse().getFullyConverted(): [CStyleCast] (unsigned int)...
# 2030| Conversion = [IntegralConversion] integral conversion
# 2030| Type = [IntType] unsigned int