|
| 1 | +/** |
| 2 | + * Provides classes for modelling writing of data to files through various standard mechanisms such as `fprintf`, `fwrite` and `operator<<`. |
| 3 | + */ |
| 4 | + |
1 | 5 | import cpp
|
2 | 6 |
|
3 | 7 | /**
|
4 |
| - * A function call that writes to a file |
| 8 | + * A function call that writes to a file. |
5 | 9 | */
|
6 | 10 | class FileWrite extends Expr {
|
7 | 11 | FileWrite() { fileWrite(this, _, _) }
|
8 | 12 |
|
| 13 | + /** |
| 14 | + * Gets a source expression of this write. |
| 15 | + */ |
9 | 16 | Expr getASource() { fileWrite(this, result, _) }
|
10 | 17 |
|
| 18 | + /** |
| 19 | + * Gets the expression for the object being written to. |
| 20 | + */ |
11 | 21 | Expr getDest() { fileWrite(this, _, result) }
|
12 | 22 | }
|
13 | 23 |
|
@@ -44,17 +54,17 @@ class BasicOStreamCall extends FunctionCall {
|
44 | 54 | */
|
45 | 55 | abstract class ChainedOutputCall extends BasicOStreamCall {
|
46 | 56 | /**
|
47 |
| - * The source expression of this output. |
| 57 | + * Gets the source expression of this output. |
48 | 58 | */
|
49 | 59 | abstract Expr getSource();
|
50 | 60 |
|
51 | 61 | /**
|
52 |
| - * The immediate destination expression of this output. |
| 62 | + * Gets the immediate destination expression of this output. |
53 | 63 | */
|
54 | 64 | abstract Expr getDest();
|
55 | 65 |
|
56 | 66 | /**
|
57 |
| - * The destination at the far left-hand end of the output chain. |
| 67 | + * Gets the destination at the far left-hand end of the output chain. |
58 | 68 | */
|
59 | 69 | Expr getEndDest() {
|
60 | 70 | // recurse into the destination
|
@@ -108,7 +118,7 @@ class WriteFunctionCall extends ChainedOutputCall {
|
108 | 118 | }
|
109 | 119 |
|
110 | 120 | /**
|
111 |
| - * Whether the function call is a call to << that eventually starts at the given file stream. |
| 121 | + * Whether the function call is a call to `operator<<` or a similar function, that eventually starts at the given file stream. |
112 | 122 | */
|
113 | 123 | private predicate fileStreamChain(ChainedOutputCall out, Expr source, Expr dest) {
|
114 | 124 | source = out.getSource() and
|
|
0 commit comments