CPP: Autoformat.

This commit is contained in:
Geoffrey White
2019-09-20 15:30:59 +01:00
parent accb8246d4
commit 9100ab9360
2 changed files with 8 additions and 10 deletions

View File

@@ -170,11 +170,10 @@ class FormattingFunctionCall extends Expr {
* format string.
*/
int getNumFormatArgument() {
result = count(this.getFormatArgument(_)) and
// format arguments must be known
exists(getTarget().(FormattingFunction).getFirstFormatArgumentIndex())
}
result = count(this.getFormatArgument(_)) and
// format arguments must be known
exists(getTarget().(FormattingFunction).getFirstFormatArgumentIndex())
}
}
/**

View File

@@ -116,15 +116,14 @@ abstract class FormattingFunction extends Function {
* the first format specifier in the format string.
*/
int getFirstFormatArgumentIndex() {
result = getNumberOfParameters()
and
result = getNumberOfParameters() and
// the formatting function either has a definition in the snapshot, or all
// `DeclarationEntry`s agree on the number of parameters (otherwise we don't
// really know the correct number)
(
hasDefinition() or
forall(FunctionDeclarationEntry fde |
fde = getADeclarationEntry() |
hasDefinition()
or
forall(FunctionDeclarationEntry fde | fde = getADeclarationEntry() |
result = fde.getNumberOfParameters()
)
)