Skip to content

Commit ef916f0

Browse files
committed
C++: Mitigate ODR violations.
1 parent 1cbe019 commit ef916f0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

cpp/ql/src/jsf/4.16 Initialization/AV Rule 145.ql

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,12 @@ predicate hasReferenceInitializer(EnumConstant c) {
3939
*/
4040
EnumConstant getNonReferenceInitializedEnumConstantByRank(Enum e, int rnk) {
4141
result =
42-
rank[rnk](EnumConstant cand, int pos |
43-
e.getEnumConstant(pos) = cand and not hasReferenceInitializer(cand)
42+
rank[rnk](EnumConstant cand, int pos, string filepath, int startline, int startcolumn |
43+
e.getEnumConstant(pos) = cand and
44+
not hasReferenceInitializer(cand) and
45+
cand.getLocation().hasLocationInfo(filepath, startline, startcolumn, _, _)
4446
|
45-
cand order by pos
47+
cand order by pos, filepath, startline, startcolumn
4648
)
4749
}
4850

0 commit comments

Comments
 (0)