diff --git a/cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll b/cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll index 1ffe2a41a6b..929a91ccf09 100644 --- a/cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll +++ b/cpp/ql/lib/semmle/code/cpp/dataflow/ExternalFlow.qll @@ -353,12 +353,26 @@ module CsvValidation { ) } + string getIncorrectConstructorSummaryOutput() { + exists(string namespace, string type, string name, string output | + type = name or + type = name + "<" + any(string s) + | + summaryModel(namespace, type, _, name, _, _, _, output, _, _, _) and + output.matches("ReturnValue%") and + result = + "Constructor model for " + namespace + "." + type + + " should use `Argument[-1]` in the output, not `ReturnValue`." + ) + } + /** Holds if some row in a CSV-based flow model appears to contain typos. */ query predicate invalidModelRow(string msg) { msg = [ getInvalidModelSignature(), getInvalidModelInput(), getInvalidModelOutput(), - getInvalidModelSubtype(), getInvalidModelColumnCount(), KindVal::getInvalidModelKind() + getInvalidModelSubtype(), getInvalidModelColumnCount(), KindVal::getInvalidModelKind(), + getIncorrectConstructorSummaryOutput() ] } }