Skip to content

Commit 63e8061

Browse files
committed
Add model validation for constructor summary models
1 parent 8bbb0ec commit 63e8061

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,12 +353,26 @@ module CsvValidation {
353353
)
354354
}
355355

356+
string getIncorrectConstructorSummaryOutput() {
357+
exists(string namespace, string type, string name, string output |
358+
type = name or
359+
type = name + "<" + any(string s)
360+
|
361+
summaryModel(namespace, type, _, name, _, _, _, output, _, _, _) and
362+
output.matches("ReturnValue%") and
363+
result =
364+
"Constructor model for " + namespace + "." + type +
365+
" should use `Argument[-1]` in the output, not `ReturnValue`."
366+
)
367+
}
368+
356369
/** Holds if some row in a CSV-based flow model appears to contain typos. */
357370
query predicate invalidModelRow(string msg) {
358371
msg =
359372
[
360373
getInvalidModelSignature(), getInvalidModelInput(), getInvalidModelOutput(),
361-
getInvalidModelSubtype(), getInvalidModelColumnCount(), KindVal::getInvalidModelKind()
374+
getInvalidModelSubtype(), getInvalidModelColumnCount(), KindVal::getInvalidModelKind(),
375+
getIncorrectConstructorSummaryOutput()
362376
]
363377
}
364378
}

0 commit comments

Comments
 (0)