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

Skip to content

Commit cc2b611

Browse files
committed
C++: Document TReturnKind, NormalReturnKind and IndirectReturnKind better.
1 parent dd27ef7 commit cc2b611

1 file changed

Lines changed: 11 additions & 5 deletions

File tree

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowPrivate.qll

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,10 +436,10 @@ newtype TPosition =
436436
}
437437

438438
private newtype TReturnKind =
439-
TNormalReturnKind(int index) {
439+
TNormalReturnKind(int indirectionIndex) {
440440
exists(IndirectReturnNode return |
441441
return.isNormalReturn() and
442-
index = return.getIndirectionIndex() - 1 // We subtract one because the return loads the value.
442+
indirectionIndex = return.getIndirectionIndex() - 1 // We subtract one because the return loads the value.
443443
)
444444
} or
445445
TIndirectReturnKind(int argumentIndex, int indirectionIndex) {
@@ -458,16 +458,22 @@ class ReturnKind extends TReturnKind {
458458
abstract string toString();
459459
}
460460

461+
/**
462+
* A value returned from a callable using a `return` statement, that is, a "normal" return.
463+
*/
461464
class NormalReturnKind extends ReturnKind, TNormalReturnKind {
462-
int index;
465+
int indirectionIndex;
463466

464-
NormalReturnKind() { this = TNormalReturnKind(index) }
467+
NormalReturnKind() { this = TNormalReturnKind(indirectionIndex) }
465468

466-
int getIndirectionIndex() { result = index }
469+
int getIndirectionIndex() { result = indirectionIndex }
467470

468471
override string toString() { result = "indirect return" }
469472
}
470473

474+
/**
475+
* A value returned from a callable through a parameter.
476+
*/
471477
private class IndirectReturnKind extends ReturnKind, TIndirectReturnKind {
472478
int argumentIndex;
473479
int indirectionIndex;

0 commit comments

Comments
 (0)