C++: Mitigate ODR violations.

This commit is contained in:
Mathias Vorreiter Pedersen
2023-12-15 17:12:37 +00:00
parent 1cbe01923d
commit ef916f0ba0

View File

@@ -39,10 +39,12 @@ predicate hasReferenceInitializer(EnumConstant c) {
*/
EnumConstant getNonReferenceInitializedEnumConstantByRank(Enum e, int rnk) {
result =
rank[rnk](EnumConstant cand, int pos |
e.getEnumConstant(pos) = cand and not hasReferenceInitializer(cand)
rank[rnk](EnumConstant cand, int pos, string filepath, int startline, int startcolumn |
e.getEnumConstant(pos) = cand and
not hasReferenceInitializer(cand) and
cand.getLocation().hasLocationInfo(filepath, startline, startcolumn, _, _)
|
cand order by pos
cand order by pos, filepath, startline, startcolumn
)
}