Skip to content

Commit 5462dcd

Browse files
committed
C++: Make final member functions not extensible.
1 parent 1f43e51 commit 5462dcd

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cpp/ql/src/utils/modelgenerator/internal/CaptureModels.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,18 @@ module ModelGeneratorInput implements ModelGeneratorInputSig<Location, CppDataFl
8585
}
8686
}
8787

88+
private predicate isFinalMemberFunction(MemberFunction mf) {
89+
mf.isFinal()
90+
or
91+
mf.getDeclaringType().isFinal()
92+
}
93+
8894
/**
8995
* Holds if the summary generated for `c` should also apply to overrides
9096
* of `c`.
9197
*/
9298
private string isExtensible(Callable c) {
93-
if c instanceof MemberFunction then result = "true" else result = "false"
99+
if isFinalMemberFunction(c) then result = "false" else result = "true"
94100
}
95101

96102
/**

0 commit comments

Comments
 (0)