Skip to content

Commit 05a487e

Browse files
committed
Rust: Repair following merge.
1 parent c0a5c63 commit 05a487e

File tree

1 file changed

+6
-36
lines changed

1 file changed

+6
-36
lines changed

rust/ql/lib/codeql/rust/dataflow/internal/ModelsAsData.qll

Lines changed: 6 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -125,41 +125,6 @@ predicate interpretModelForTest(QlBuiltins::ExtensionId madId, string model) {
125125
)
126126
}
127127

128-
private predicate summaryModel(
129-
Function f, string input, string output, string kind, Provenance provenance, boolean isInherited,
130-
QlBuiltins::ExtensionId madId
131-
) {
132-
exists(string path, Function f0 |
133-
summaryModel(path, input, output, kind, provenance, madId) and
134-
f0.getCanonicalPath() = path
135-
|
136-
f = f0 and
137-
isInherited = false
138-
or
139-
f.implements(f0) and
140-
isInherited = true
141-
)
142-
}
143-
144-
private predicate summaryModelRelevant(
145-
Function f, string input, string output, string kind, Provenance provenance, boolean isInherited,
146-
QlBuiltins::ExtensionId madId
147-
) {
148-
summaryModel(f, input, output, kind, provenance, isInherited, madId) and
149-
// Only apply generated or inherited models to functions in library code and
150-
// when no strictly better model (or neutral model) exists
151-
if provenance.isGenerated() or isInherited = true
152-
then
153-
not f.fromSource() and
154-
not exists(Provenance other | summaryModel(f, _, _, _, other, false, _) |
155-
provenance.isGenerated() and other.isManual()
156-
or
157-
provenance = other and isInherited = true
158-
) and
159-
not neutralModel(f.getCanonicalPath(), "summary", _, _)
160-
else any()
161-
}
162-
163128
private class SummarizedCallableFromModel extends SummarizedCallable::Range {
164129
string input_;
165130
string output_;
@@ -179,7 +144,12 @@ private class SummarizedCallableFromModel extends SummarizedCallable::Range {
179144
isExact_ = false and
180145
// making inherited models generated means that source code definitions and
181146
// exact generated models take precedence
182-
p_ = "hq-generated"
147+
p_ = "hq-generated" and
148+
// Only apply generated models (including inherited models) when no neutral model exists
149+
not (
150+
p_.isGenerated() and
151+
neutralModel(path, "summary", _, _)
152+
)
183153
)
184154
}
185155

0 commit comments

Comments
 (0)