@@ -2,20 +2,45 @@ import semmle.code.cpp.Location
2
2
private import semmle.code.cpp.Enclosing
3
3
private import semmle.code.cpp.internal.Type
4
4
5
- cached @element resolveElement ( @element e ) {
5
+ /**
6
+ * Get the `@element` that represents this `@element`.
7
+ * Normally this will simply be `e`, but sometimes it is not.
8
+ * For example, for an incomplete struct `e` the result may be a
9
+ * complete struct with the same name.
10
+ */
11
+ private cached @element resolveElement ( @element e ) {
6
12
if isClass ( e )
7
13
then result = resolve ( e )
8
14
else result = e
9
15
}
10
16
17
+ /**
18
+ * Get the `Element` that represents this `@element`.
19
+ * Normally this will simply be a cast of `e`, but sometimes it is not.
20
+ * For example, for an incomplete struct `e` the result may be a
21
+ * complete struct with the same name.
22
+ */
11
23
Element mkElement ( @element e ) {
12
24
result = resolveElement ( e )
13
25
}
14
26
27
+ /**
28
+ * Get an `@element` that resolves to the `Element`. This should
29
+ * normally only be called from member predicates, where `e` is not
30
+ * `this` and you need the result for an argument to a database
31
+ * extensional.
32
+ * See `underlyingElement` for when `e` is `this`.
33
+ */
15
34
@element unresolveElement ( Element e ) {
16
35
resolveElement ( result ) = e
17
36
}
18
37
38
+ /**
39
+ * Get the `@element` that this `Element` extends. This should normally
40
+ * only be called from member predicates, where `e` is `this` and you
41
+ * need the result for an argument to a database extensional.
42
+ * See `unresolveElement` for when `e` is `this`.
43
+ */
19
44
@element underlyingElement ( Element e ) {
20
45
result = e
21
46
}
0 commit comments