Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 940ba69

Browse files
author
AndreiDiaconu1
committed
Arithmetic increment and decrement expressions
Correct code is now produced for increment and decrement expressions Modified producesExprResult() and TTranslatedLoad() so that no loads are done from outside the crement exprs and that the VariableAddress generated from the access of the operator variable is recognized as an expr that produces result.
1 parent 3bc6456 commit 940ba69

3 files changed

Lines changed: 203 additions & 320 deletions

File tree

csharp/ql/src/semmle/code/csharp/ir/implementation/raw/internal/TranslatedElement.qll

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ newtype TTranslatedElement =
193193
// TODO: Revisit and make sure Loads are only used when needed
194194
expr instanceof AssignableRead and
195195
not expr.getParent() instanceof ArrayAccess and
196-
not expr.getType() instanceof RefType
196+
not expr.getType() instanceof RefType and
197+
// Ignore loads for reads in `++` and `--` since their
198+
// translated elements handle them
199+
not expr.getParent() instanceof MutatorOperation
197200
} or
198201
// An expression most naturally translated as control flow.
199202
TTranslatedNativeCondition(Expr expr) {

0 commit comments

Comments
 (0)