@@ -150,6 +150,8 @@ module Sem implements Semantic {
150150 }
151151 }
152152
153+ predicate isAssignOp ( BinaryExpr bin ) { bin instanceof AssignOp }
154+
153155 class RelationalExpr = J:: ComparisonExpr ;
154156
155157 abstract class UnaryExpr extends Expr {
@@ -176,18 +178,34 @@ module Sem implements Semantic {
176178 override Expr getOperand ( ) { result = super .getExpr ( ) }
177179 }
178180
179- // TODO: Implement once utils are properly shared
180- class AddOneExpr extends UnaryExpr {
181- AddOneExpr ( ) { none ( ) }
181+ class PreIncExpr extends UnaryExpr instanceof J :: PreIncExpr {
182+ override Expr getOperand ( ) { result = super . getExpr ( ) }
183+ }
182184
183- override Expr getOperand ( ) { none ( ) }
185+ class PreDecExpr extends UnaryExpr instanceof J:: PreDecExpr {
186+ override Expr getOperand ( ) { result = super .getExpr ( ) }
184187 }
185188
186- // TODO: Implement once utils are properly shared
187- class SubOneExpr extends UnaryExpr {
188- SubOneExpr ( ) { none ( ) }
189+ class PostIncExpr extends UnaryExpr instanceof J :: PostIncExpr {
190+ override Expr getOperand ( ) { result = super . getExpr ( ) }
191+ }
189192
190- override Expr getOperand ( ) { none ( ) }
193+ class PostDecExpr extends UnaryExpr instanceof J:: PostDecExpr {
194+ override Expr getOperand ( ) { result = super .getExpr ( ) }
195+ }
196+
197+ class CopyValueExpr extends UnaryExpr {
198+ CopyValueExpr ( ) {
199+ this instanceof J:: PlusExpr or
200+ this instanceof J:: AssignExpr or
201+ this instanceof LocalVariableDeclExpr
202+ }
203+
204+ override Expr getOperand ( ) {
205+ result = this .( J:: PlusExpr ) .getExpr ( ) or
206+ result = this .( J:: AssignExpr ) .getSource ( ) or
207+ result = this .( J:: LocalVariableDeclExpr ) .getInit ( )
208+ }
191209 }
192210
193211 class ConditionalExpr = J:: ConditionalExpr ;
@@ -228,7 +246,9 @@ module Sem implements Semantic {
228246
229247 class SsaPhiNode extends SsaVariable instanceof SSA:: SsaPhiNode { }
230248
231- class SsaExplicitUpdate extends SsaVariable instanceof SSA:: SsaExplicitUpdate { }
249+ class SsaExplicitUpdate extends SsaVariable instanceof SSA:: SsaExplicitUpdate {
250+ Expr getDefiningExpr ( ) { result = super .getDefiningExpr ( ) }
251+ }
232252
233253 final private class FinalSsaReadPosition = SsaReadPos:: SsaReadPosition ;
234254
@@ -295,8 +315,6 @@ module IntDelta implements DeltaSig {
295315}
296316
297317module JavaLangImpl implements LangSig< Sem , IntDelta > {
298- predicate ignoreSsaReadCopy ( Sem:: Expr e ) { none ( ) }
299-
300318 /**
301319 * Holds if `e >= bound` (if `upper = false`) or `e <= bound` (if `upper = true`).
302320 */
@@ -355,14 +373,6 @@ module JavaLangImpl implements LangSig<Sem, IntDelta> {
355373
356374 predicate ignoreExprBound ( Sem:: Expr e ) { none ( ) }
357375
358- predicate ignoreZeroLowerBound ( Sem:: Expr e ) { none ( ) }
359-
360- predicate ignoreSsaReadArithmeticExpr ( Sem:: Expr e ) { none ( ) }
361-
362- predicate ignoreSsaReadAssignment ( Sem:: SsaVariable v ) { none ( ) }
363-
364- Sem:: Expr specificSsaRead ( Sem:: SsaVariable v , int delta ) { none ( ) }
365-
366376 predicate additionalValueFlowStep ( Sem:: Expr dest , Sem:: Expr src , int delta ) { none ( ) }
367377
368378 Sem:: Type getAlternateType ( Sem:: Expr e ) { none ( ) }
@@ -376,8 +386,6 @@ module Utils implements UtilSig<Sem, IntDelta> {
376386 private import RangeUtils as RU
377387 private import semmle.code.java.dataflow.internal.rangeanalysis.SsaReadPositionCommon as SsaReadPos
378388
379- Sem:: Expr semSsaRead ( Sem:: SsaVariable v , int delta ) { result = RU:: ssaRead ( v , delta ) }
380-
381389 Sem:: Guard semEqFlowCond (
382390 Sem:: SsaVariable v , Sem:: Expr e , int delta , boolean isEq , boolean testIsTrue
383391 ) {
@@ -411,7 +419,7 @@ module Bounds implements BoundSig<Location, Sem, IntDelta> {
411419 class SemZeroBound = ZeroBound ;
412420
413421 class SemSsaBound extends SsaBound {
414- Sem:: SsaVariable getAVariable ( ) { result = super .getSsa ( ) }
422+ Sem:: SsaVariable getVariable ( ) { result = super .getSsa ( ) }
415423 }
416424}
417425
0 commit comments