|
2 | 2 | * INTERNAL use only. This is an experimental API subject to change without notice.
|
3 | 3 | *
|
4 | 4 | * Provides classes and predicates for dealing with flow models specified in CSV format.
|
| 5 | + * |
| 6 | + * The CSV specification has the following columns: |
| 7 | + * - Sources: |
| 8 | + * `namespace; type; subtypes; name; signature; ext; output; kind` |
| 9 | + * - Sinks: |
| 10 | + * `namespace; type; subtypes; name; signature; ext; input; kind` |
| 11 | + * - Summaries: |
| 12 | + * `namespace; type; subtypes; name; signature; ext; input; output; kind` |
| 13 | + * |
| 14 | + * The interpretation of a row is similar to API-graphs with a left-to-right |
| 15 | + * reading. |
| 16 | + * 1. The `namespace` column selects a package. |
| 17 | + * 2. The `type` column selects a type within that package. |
| 18 | + * 3. The `subtypes` is a boolean that indicates whether to jump to an |
| 19 | + * arbitrary subtype of that type. |
| 20 | + * 4. The `name` column optionally selects a specific named member of the type. |
| 21 | + * 5. The `signature` column optionally restricts the named member. If |
| 22 | + * `signature` is blank then no such filtering is done. The format of the |
| 23 | + * signature is a comma-separated list of types enclosed in parentheses. The |
| 24 | + * types can be short names or fully qualified names (mixing these two options |
| 25 | + * is not allowed within a single signature). |
| 26 | + * 6. The `ext` column specifies additional API-graph-like edges. Currently |
| 27 | + * there are only two valid values: "" and "Annotated". The empty string has no |
| 28 | + * effect. "Annotated" applies if `name` and `signature` were left blank and |
| 29 | + * acts by selecting an element that is annotated by the annotation type |
| 30 | + * selected by the first 4 columns. This can be another member such as a field |
| 31 | + * or method, or a parameter. |
| 32 | + * 7. The `input` column specifies how data enters the element selected by the |
| 33 | + * first 6 columns, and the `output` column specifies how data leaves the |
| 34 | + * element selected by the first 6 columns. An `input` can be either "", |
| 35 | + * "Argument", "Argument[n]", "ReturnValue": |
| 36 | + * - "": Selects a write to the selected element in case this is a field. |
| 37 | + * - "Argument": Selects any argument in a call to the selected element. |
| 38 | + * - "Argument[n]": Similar to "Argument" but restricted to a specific numbered |
| 39 | + * argument (zero-indexed, and `-1` specifies the qualifier). |
| 40 | + * - "ReturnValue": Selects a value being returned by the selected element. |
| 41 | + * This requires that the selected element is a method with a body. |
| 42 | + * |
| 43 | + * An `output` can be either "", "Argument", "Argument[n]", "Parameter", |
| 44 | + * "Parameter[n]", or "ReturnValue": |
| 45 | + * - "": Selects a read of a selected field, or a selected parameter. |
| 46 | + * - "Argument": Selects the post-update value of an argument in a call to the |
| 47 | + * selected element. That is, the value of the argument after the call returns. |
| 48 | + * - "Argument[n]": Similar to "Argument" but restricted to a specific numbered |
| 49 | + * argument (zero-indexed, and `-1` specifies the qualifier). |
| 50 | + * - "Parameter": Selects the value of a parameter of the selected element. |
| 51 | + * "Parameter" is also allowed in case the selected element is already a |
| 52 | + * parameter itself. |
| 53 | + * - "Parameter[n]": Similar to "Parameter" but restricted to a specific |
| 54 | + * numbered parameter (zero-indexed, and `-1` specifies the value of `this`). |
| 55 | + * - "ReturnValue": Selects the return value of a call to the selected element. |
5 | 56 | */
|
6 | 57 |
|
7 | 58 | import java
|
@@ -255,7 +306,7 @@ private Element interpretElement0(
|
255 | 306 | m.hasName(name)
|
256 | 307 | |
|
257 | 308 | signature = "" or
|
258 |
| - m.(Callable).getSignature().matches("%" + signature) or |
| 309 | + m.(Callable).getSignature() = any(string nameprefix) + signature or |
259 | 310 | paramsString(m) = signature
|
260 | 311 | )
|
261 | 312 | or
|
@@ -419,6 +470,12 @@ private predicate interpretInput(string input, int idx, Top ref, TAstOrNode node
|
419 | 470 | n.asExpr() = ret.getResult() and
|
420 | 471 | mid = ret.getEnclosingCallable()
|
421 | 472 | )
|
| 473 | + or |
| 474 | + exists(FieldWrite fw | |
| 475 | + c = "" and |
| 476 | + fw.getField() = mid and |
| 477 | + n.asExpr() = fw.getRHS() |
| 478 | + ) |
422 | 479 | )
|
423 | 480 | }
|
424 | 481 |
|
|
0 commit comments