Merge pull request #21280 from MathiasVP/make-getChildCount-more-robust

C++: Make 'getChildCount' more robust by counting indices instead of elements
This commit is contained in:
Mathias Vorreiter Pedersen
2026-02-06 12:19:20 +00:00
committed by GitHub

View File

@@ -390,7 +390,7 @@ class TranslatedDeclStmt extends TranslatedStmt {
override TranslatedElement getLastChild() { result = this.getChild(this.getChildCount() - 1) }
private int getChildCount() { result = count(this.getDeclarationEntry(_)) }
private int getChildCount() { result = count(int i | exists(this.getDeclarationEntry(i))) }
IRDeclarationEntry getIRDeclarationEntry(int index) {
result.hasIndex(index) and