Skip to content

Commit 5106626

Browse files
committed
CPP: QLDoc helper predicates.
1 parent 3584c0b commit 5106626

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

cpp/ql/src/Security/CWE/CWE-457/InitializationFunctions.qll

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -619,35 +619,41 @@ Function getAPossibleDefinition(Function undefinedFunction) {
619619
result.isDefined()
620620
}
621621

622+
/**
623+
* Helper predicate for `getTarget`, that computes possible targets of a `Call`.
624+
*
625+
* If there is at least one defined target after performing some simple virtual dispatch
626+
* resolution, then the result is all the defined targets.
627+
*/
622628
private Function getTarget1(Call c) {
623-
/*
624-
* If there is at least one defined target after performing some simple virtual dispatch
625-
* resolution, then the result is all the defined targets.
626-
*/
627-
628629
result = VirtualDispatch::getAViableTarget(c) and
629630
result.isDefined()
630631
}
631632

633+
/**
634+
* Helper predicate for `getTarget`, that computes possible targets of a `Call`.
635+
*
636+
* If we can use the heuristic matching of functions to find definitions for some of the viable
637+
* targets, return those.
638+
*/
632639
private Function getTarget2(Call c) {
633-
/*
634-
* If we can use the heuristic matching of functions to find definitions for some of the viable
635-
* targets, return those.
636-
*/
637-
638640
not exists(getTarget1(c)) and
639641
result = getAPossibleDefinition(VirtualDispatch::getAViableTarget(c))
640642
}
641643

644+
/**
645+
* Helper predicate for `getTarget`, that computes possible targets of a `Call`.
646+
*
647+
* Otherwise, the result is the undefined `Function` instances.
648+
*/
642649
private Function getTarget3(Call c) {
643650
not exists(getTarget1(c)) and
644651
not exists(getTarget2(c)) and
645-
// Otherwise, the result is the undefined `Function` instances.
646652
result = VirtualDispatch::getAViableTarget(c)
647653
}
648654

649655
/**
650-
* Gets a possible target for the Call, using the name and parameter matching if we did not associate
656+
* Gets a possible target for the `Call`, using the name and parameter matching if we did not associate
651657
* this call with a specific definition at link or compile time, and performing simple virtual
652658
* dispatch resolution.
653659
*/

0 commit comments

Comments
 (0)