@@ -9,17 +9,24 @@ private import semmle.code.cpp.internal.ResolveClass
99 * `Enum`, and `TypedefType`.
1010 */
1111class UserType extends Type , Declaration , NameQualifyingElement , AccessHolder , @usertype {
12- /** the name of this type */
12+ /**
13+ * Gets the name of this type.
14+ */
1315 override string getName ( ) { usertypes ( underlyingElement ( this ) , result , _) }
1416
15- /** the simple name of this type, without any template parameters */
17+ /**
18+ * Gets the simple name of this type, without any template parameters. For example
19+ * if the name of the type is `"myType<int>"`, the simple name is just `"myType"`.
20+ */
1621 string getSimpleName ( ) {
1722 result = getName ( ) .regexpReplaceAll ( "<.*" , "" )
1823 }
1924
2025 override predicate hasName ( string name ) {
2126 usertypes ( underlyingElement ( this ) , name , _)
2227 }
28+
29+ /** Holds if this type is anonymous. */
2330 predicate isAnonymous ( ) {
2431 getName ( ) .matches ( "(unnamed%" )
2532 }
@@ -54,20 +61,24 @@ class UserType extends Type, Declaration, NameQualifyingElement, AccessHolder, @
5461 result .isDefinition ( )
5562 }
5663
57- /** the location of the definition */
5864 override Location getDefinitionLocation ( ) {
5965 if exists ( getDefinition ( ) ) then
6066 result = getDefinition ( ) .getLocation ( )
6167 else
6268 exists ( Class t | this .( Class ) .isConstructedFrom ( t ) and result = t .getDefinition ( ) .getLocation ( ) )
6369 }
6470
65- /** Gets the function that directly encloses this type (if any). */
71+ /**
72+ * Gets the function that directly encloses this type (if any).
73+ */
6674 Function getEnclosingFunction ( ) {
6775 enclosingfunction ( underlyingElement ( this ) , unresolveElement ( result ) )
6876 }
6977
70- /** Whether this is a local type (i.e. a type that has a directly-enclosing function). */
78+ /**
79+ * Holds if this is a local type (that is, a type that has a directly-enclosing
80+ * function).
81+ */
7182 predicate isLocal ( ) {
7283 exists ( getEnclosingFunction ( ) )
7384 }
0 commit comments