@@ -465,7 +465,7 @@ private predicate isFunctionConstructedFrom(Function f, Function templateFunc) {
465465}
466466
467467/** Gets the fully templated version of `f`. */
468- private Function getFullyTemplatedFunction ( Function f ) {
468+ Function getFullyTemplatedFunction ( Function f ) {
469469 not f .isFromUninstantiatedTemplate ( _) and
470470 (
471471 exists ( Class c , Class templateClass , int i |
@@ -559,27 +559,35 @@ private string getTypeName(Type t, boolean needsSpace) {
559559
560560/**
561561 * Gets a type name for the `n`'th parameter of `f` without any template
562- * arguments. The result may be a string representing a type for which the
563- * typedefs have been resolved.
562+ * arguments.
563+ *
564+ * If `canonical = false` then the result may be a string representing a type
565+ * for which the typedefs have been resolved. If `canonical = true` then the
566+ * result will be a string representing a type without resolving `typedefs`.
564567 */
565568bindingset [ f]
566569pragma [ inline_late]
567- string getParameterTypeWithoutTemplateArguments ( Function f , int n ) {
570+ string getParameterTypeWithoutTemplateArguments ( Function f , int n , boolean canonical ) {
568571 exists ( string s , string base , string specifiers , Type t |
569572 t = f .getParameter ( n ) .getType ( ) and
570573 // The name of the string can either be the possibly typedefed name
571574 // or an alternative name where typedefs has been resolved.
572575 // `getTypeName(t, _)` is almost equal to `t.resolveTypedefs().getName()`,
573576 // except that `t.resolveTypedefs()` doesn't have a result when the
574577 // resulting type doesn't appear in the database.
575- s = [ t .getName ( ) , getTypeName ( t , _) ] and
578+ (
579+ s = t .getName ( ) and canonical = true
580+ or
581+ s = getTypeName ( t , _) and canonical = false
582+ ) and
576583 parseAngles ( s , base , _, specifiers ) and
577584 result = base + specifiers
578585 )
579586 or
580587 f .isVarargs ( ) and
581588 n = f .getNumberOfParameters ( ) and
582- result = "..."
589+ result = "..." and
590+ canonical = true
583591}
584592
585593/**
@@ -590,7 +598,7 @@ private string getTypeNameWithoutFunctionTemplates(Function f, int n, int remain
590598 exists ( Function templateFunction |
591599 templateFunction = getFullyTemplatedFunction ( f ) and
592600 remaining = templateFunction .getNumberOfTemplateArguments ( ) and
593- result = getParameterTypeWithoutTemplateArguments ( templateFunction , n )
601+ result = getParameterTypeWithoutTemplateArguments ( templateFunction , n , _ )
594602 )
595603 or
596604 exists ( string mid , TypeTemplateParameter tp , Function templateFunction |
@@ -627,7 +635,7 @@ private string getTypeNameWithoutClassTemplates(Function f, int n, int remaining
627635}
628636
629637/** Gets the string representation of the `i`'th parameter of `c`. */
630- private string getParameterTypeName ( Function c , int i ) {
638+ string getParameterTypeName ( Function c , int i ) {
631639 result = getTypeNameWithoutClassTemplates ( c , i , 0 )
632640}
633641
0 commit comments