Skip to content

Commit d6352b4

Browse files
committed
C++: Fix IR generation for builtin operations.
1 parent f58757f commit d6352b4

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/TranslatedExpr.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3208,6 +3208,13 @@ class TranslatedBuiltInOperation extends TranslatedNonConstantExpr {
32083208

32093209
final override Instruction getResult() { result = this.getInstruction(OnlyInstructionTag()) }
32103210

3211+
/**
3212+
* Gets the rnk'th (0-indexed) child for which a `TranslatedElement` exists.
3213+
*
3214+
* We use this predicate to filter out `TypeName` expressions that sometimes
3215+
* occur in builtin operations since the IR doesn't have an instruction to
3216+
* represent a reference to a type.
3217+
*/
32113218
private TranslatedElement getRankedChild(int rnk) {
32123219
result = rank[rnk + 1](int id, TranslatedElement te | te = this.getChild(id) | te order by id)
32133220
}

0 commit comments

Comments
 (0)