@@ -51,40 +51,36 @@ module Input implements InputSig<DataFlowImplSpecific::CppDataFlow> {
5151
5252 string encodeWithContent ( ContentSet c , string arg ) { result = "WithContent" + c and arg = "" }
5353
54- bindingset [ token]
55- ParameterPosition decodeUnknownParameterPosition ( AccessPath:: AccessPathTokenBase token ) {
56- // needed to support `Argument[x..y]` ranges, `Argument[-1]`, and indirections `*Argument[0]`.
57- exists ( int indirection , string argPosString , int argPos |
58- token .getName ( ) = "Argument" and
59- token .getAnArgument ( ) = indirectionString ( indirection ) + argPosString and
60- argPos = AccessPath:: parseInt ( argPosString ) and
54+ /**
55+ * Decodes an argument / parameter position string, for example the `0` in `Argument[0]`.
56+ * Supports ranges (`Argument[x..y]`), qualifiers (`Argument[-1]`), indirections
57+ * (`Argument[*x]`) and combinations (such as `Argument[**0..1]`).
58+ */
59+ private bindingset [ argString] TPosition decodePosition ( string argString ) {
60+ exists ( int indirection , string posString , int pos |
61+ argString = indirectionString ( indirection ) + posString and
62+ pos = AccessPath:: parseInt ( posString ) and
6163 (
62- argPos >= 0 and indirection = 0 and result = TDirectPosition ( argPos )
64+ pos >= 0 and indirection = 0 and result = TDirectPosition ( pos )
6365 or
64- argPos >= 0 and indirection > 0 and result = TIndirectionPosition ( argPos , indirection )
66+ pos >= 0 and indirection > 0 and result = TIndirectionPosition ( pos , indirection )
6567 or
66- // `Argument[-1]` is the qualifier object `*this`, not the `this` pointer itself
67- argPos = - 1 and result = TIndirectionPosition ( argPos , indirection + 1 )
68+ // `Argument[-1]` / `Parameter[-1]` is the qualifier object `*this`, not the `this` pointer itself.
69+ pos = - 1 and result = TIndirectionPosition ( pos , indirection + 1 )
6870 )
6971 )
7072 }
7173
74+ bindingset [ token]
75+ ParameterPosition decodeUnknownParameterPosition ( AccessPath:: AccessPathTokenBase token ) {
76+ token .getName ( ) = "Argument" and
77+ result = decodePosition ( token .getAnArgument ( ) )
78+ }
79+
7280 bindingset [ token]
7381 ArgumentPosition decodeUnknownArgumentPosition ( AccessPath:: AccessPathTokenBase token ) {
74- // needed to support `Argument[x..y]` ranges, `Argument[-1]`, and indirections `*Argument[0]`.
75- exists ( int indirection , string paramPosString , int paramPos |
76- token .getName ( ) = "Parameter" and
77- token .getAnArgument ( ) = indirectionString ( indirection ) + paramPosString and
78- paramPos = AccessPath:: parseInt ( paramPosString ) and
79- (
80- paramPos >= 0 and indirection = 0 and result = TDirectPosition ( paramPos )
81- or
82- paramPos >= 0 and indirection > 0 and result = TIndirectionPosition ( paramPos , indirection )
83- or
84- // `Argument[-1]` is the qualifier object `*this`, not the `this` pointer itself
85- paramPos = - 1 and result = TIndirectionPosition ( paramPos , indirection + 1 )
86- )
87- )
82+ token .getName ( ) = "Parameter" and
83+ result = decodePosition ( token .getAnArgument ( ) )
8884 }
8985
9086 bindingset [ token]
0 commit comments