Skip to content

Commit e0af30a

Browse files
author
Robert Marsh
committed
C++: clean up commented-out code
1 parent 77c5a8e commit e0af30a

File tree

1 file changed

+11
-40
lines changed

1 file changed

+11
-40
lines changed

cpp/ql/src/semmle/code/cpp/valuenumbering/HashCons.qll

Lines changed: 11 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ private cached newtype HCBase =
9292
// given a unique number based on the expression itself.
9393
HC_Unanalyzable(Expr e) { not analyzableExpr(e,_) }
9494

95+
/** Used to implement hash-consing of argument lists */
9596
private cached newtype HC_Args =
9697
HC_EmptyArgs(Function fcn) {
9798
any()
@@ -377,14 +378,6 @@ private predicate analyzableMemberFunctionCall(
377378
strictcount(fc.getQualifier()) = 1
378379
}
379380

380-
private predicate analyzableFunctionCall(
381-
FunctionCall fc
382-
) {
383-
analyzableNonmemberFunctionCall(fc)
384-
or
385-
analyzableMemberFunctionCall(fc)
386-
}
387-
388381
private predicate mk_MemberFunctionCall(
389382
Function fcn,
390383
HC qual,
@@ -405,40 +398,18 @@ private predicate mk_MemberFunctionCall(
405398
)
406399
}
407400

408-
/*
409-
private predicate analyzableImplicitThisFunctionCall(FunctionCall fc) {
410-
forall(int i | exists(fc.getArgument(i)) | strictcount(fc.getArgument(i)) = 1) and
411-
strictcount(fc.getTarget()) = 1 and
412-
fc.getQualifier().(ThisExpr).isCompilerGenerated() and
413-
fc.getTarget().isMember()
414-
}
415-
416-
private predicate mk_ImplicitThisFunctionCall(Function fcn, Function targ, HC_Args args, FunctionCall fc) {
417-
analyzableImplicitThisFunctionCall(fc) and
418-
fc.getTarget() = targ and
419-
fc.getEnclosingFunction() = fcn and
420-
analyzableImplicitThisFunctionCall(fc) and
421-
(
422-
exists(HC head, HC_Args tail |
423-
args = HC_ArgCons(targ, head, fc.getNumberOfArguments() - 1, tail) and
424-
mk_ArgCons(targ, head, fc.getNumberOfArguments() - 1, tail, fc)
425-
)
426-
or
427-
fc.getNumberOfArguments() = 0 and
428-
args = HC_EmptyArgs(targ)
429-
)
401+
private predicate analyzableFunctionCall(
402+
FunctionCall fc
403+
) {
404+
analyzableNonmemberFunctionCall(fc)
405+
or
406+
analyzableMemberFunctionCall(fc)
430407
}
431408

432-
private predicate mk_ImplicitThisFunctionCall_with_qualifier(
433-
Function fcn,
434-
Function targ,
435-
HC qual,
436-
HC_Args args,
437-
FunctionCall fc) {
438-
mk_ImplicitThisFunctionCall(fcn, targ, args, fc) and
439-
qual = HC_ThisExpr(fcn)
440-
}
441-
*/
409+
/**
410+
* Holds if `fc` is a call to `fcn`, `fc`'s first `i-1` arguments have hash-cons
411+
* `list`, and `fc`'s `i`th argument has hash-cons `hc`
412+
*/
442413
private predicate mk_ArgCons(Function fcn, HC hc, int i, HC_Args list, FunctionCall fc) {
443414
analyzableFunctionCall(fc) and
444415
fc.getTarget() = fcn and

0 commit comments

Comments
 (0)