@@ -2,41 +2,38 @@ import semmle.code.cpp.Location
22private import semmle.code.cpp.Enclosing
33private import semmle.code.cpp.internal.ResolveClass
44
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 ) {
12- if isClass ( e )
13- then result = resolveClass ( e )
14- else result = e
15- }
16-
175/**
186 * Get the `Element` that represents this `@element`.
197 * Normally this will simply be a cast of `e`, but sometimes it is not.
208 * For example, for an incomplete struct `e` the result may be a
219 * complete struct with the same name.
2210 */
11+ pragma [ inline]
2312Element mkElement ( @element e ) {
24- result = resolveElement ( e )
13+ unresolveElement ( result ) = e
2514}
2615
2716/**
28- * Get an `@element` that resolves to the `Element`. This should
17+ * INTERNAL: Do not use.
18+ *
19+ * Gets an `@element` that resolves to the `Element`. This should
2920 * normally only be called from member predicates, where `e` is not
3021 * `this` and you need the result for an argument to a database
3122 * extensional.
3223 * See `underlyingElement` for when `e` is `this`.
3324 */
25+ pragma [ inline]
3426@element unresolveElement ( Element e ) {
35- resolveElement ( result ) = e
27+ not result instanceof @usertype and
28+ result = e
29+ or
30+ e = resolveClass ( result )
3631}
3732
3833/**
39- * Get the `@element` that this `Element` extends. This should normally
34+ * INTERNAL: Do not use.
35+ *
36+ * Gets the `@element` that this `Element` extends. This should normally
4037 * only be called from member predicates, where `e` is `this` and you
4138 * need the result for an argument to a database extensional.
4239 * See `unresolveElement` for when `e` is not `this`.
@@ -53,10 +50,6 @@ Element mkElement(@element e) {
5350 * `getLocation`, or `hasLocationInfo`.
5451 */
5552class ElementBase extends @element {
56- ElementBase ( ) {
57- this = resolveElement ( _)
58- }
59-
6053 /** Gets a textual representation of this element. */
6154 string toString ( ) { none ( ) }
6255}
0 commit comments