[CPP-340] Remove use of getUnderlyingType() predicate as it does

not appear necessary.  Correct comment to refer to
           arguments rather than parameters.
This commit is contained in:
Ziemowit Laski
2019-04-10 10:51:22 -07:00
parent dc7497835e
commit d76138f189
2 changed files with 6 additions and 6 deletions

View File

@@ -53,10 +53,10 @@ predicate argTypeMayBeUsed(Type arg, Type parm) {
or
// pointers to compatible types
pointerArgTypeMayBeUsed(arg.(PointerType).getBaseType().getUnspecifiedType(),
parm.(PointerType).getBaseType().getUnderlyingType().getUnspecifiedType())
parm.(PointerType).getBaseType().getUnspecifiedType())
or
pointerArgTypeMayBeUsed(arg.(PointerType).getBaseType().getUnspecifiedType(),
parm.(ArrayType).getBaseType().getUnderlyingType().getUnspecifiedType())
parm.(ArrayType).getBaseType().getUnspecifiedType())
}
// This predicate doesn't necessarily have to exist, but if it does exist
@@ -65,8 +65,8 @@ predicate argTypeMayBeUsed(Type arg, Type parm) {
// Its body could also just be hand-inlined where it's used.
pragma[inline]
predicate argMayBeUsed(Expr arg, Parameter parm) {
argTypeMayBeUsed(arg.getFullyConverted().getType().getUnderlyingType().getUnspecifiedType(),
parm.getType().getUnderlyingType().getUnspecifiedType())
argTypeMayBeUsed(arg.getFullyConverted().getType().getUnspecifiedType(),
parm.getType().getUnspecifiedType())
}
// True if function was ()-declared, but not (void)-declared
@@ -88,5 +88,5 @@ where
not argMayBeUsed(fc.getArgument(p.getIndex()), p)
select fc, "Calling $@: argument $@ of type $@ is incompatible with parameter $@", f, f.toString(),
fc.getArgument(p.getIndex()) as arg, arg.toString(),
arg.getFullyConverted().getType().getUnderlyingType().getUnspecifiedType() as atype,
arg.getFullyConverted().getType().getUnspecifiedType() as atype,
atype.toString(), p, p.getTypedName()

View File

@@ -1,5 +1,5 @@
/**
* @name Call to function with extraneous parameters
* @name Call to function with extraneous arguments
* @description A function call to a function passed more arguments than there are
* declared parameters of the function. This may indicate
* that the code does not follow the author's intent.