Improve documentation

This commit is contained in:
Chris Smowton
2021-03-18 12:11:00 +00:00
committed by Owen Mansel-Chan
parent 6645613eb8
commit 204e313c3b
2 changed files with 10 additions and 2 deletions

View File

@@ -376,7 +376,7 @@ class StructType extends @structtype, CompositeType {
}
/**
* hasEmbeddedField holds if there is an embedded field at int `depth`, with either type `tp` or `tp`'s pointer type.
* Holds if there is an embedded field at `depth`, with either type `tp` or a pointer to `tp`.
*/
private predicate hasEmbeddedField(Type tp, int depth) {
exists(Field f | this.hasFieldCand(_, f, depth, true) |
@@ -386,7 +386,7 @@ class StructType extends @structtype, CompositeType {
}
/**
* getFieldOfEmbedded gets a field of `embeddedParent`, which is then embedded into this struct type.
* Gets a field of `embeddedParent`, which is then embedded into this struct type.
*/
Field getFieldOfEmbedded(Field embeddedParent, string name, int depth, boolean isEmbedded) {
// embeddedParent is a field of 'this' at depth 'depth - 1'

View File

@@ -368,8 +368,16 @@ module IR {
ImplicitFieldReadInstruction() { this = MkImplicitFieldSelection(e, _, implicitField) }
/**
* Gets the selector expression that requires this implicit field read.
*/
SelectorExpr getSelectorExpr() { result = e }
/**
* Gets the field being read. Note this is an embedded field that is not explicitly specified
* in `getSelectorExpr()`, whereas the field `getSelectorExpr()` refers to is the promoted field
* contained within this embedded field or in turn within a field that it embeds.
*/
Field getField() { result = implicitField }
override predicate reads(ValueEntity v) { v = implicitField }