CodeQL library for C/C++
codeql/cpp-all 0.12.9 (changelog, source)
Search

Class FixedWidthEnumType

An enum type based on a fixed-width integer type. For instance, enum e: uint8_t = { a, b };

Import path

import cpp

Direct supertypes

Indirect supertypes

Inherited predicates

canAccessClass

Holds if a base class base of derived is accessible at this (N4140 11.2/4). When this holds, and derived has only one base subobject of type base, code in this can implicitly convert a pointer to derived into a pointer to base. Conversely, if such a conversion is possible then this predicate holds.

from AccessHolder
canAccessMember

Holds if a non-static member member is accessible at this when named in a class derived that is derived from or equal to the declaring class of member (N4140 11.2/5 and 11.4).

from AccessHolder
couldAccessMember

Holds if a hypothetical non-static member of memberClass with access specifier memberAccess is accessible at this when named in a class derived that is derived from or equal to memberClass (N4140 11.2/5 and 11.4).

from AccessHolder
explain

Gets a detailed string representation explaining the AST of this type (with all specifiers and nested constructs such as pointers). This is intended to help debug queries and is a very expensive operation; not to be used in production queries.

from UserType
findRootCause

Gets the source of this element: either itself or a macro that expanded to this element.

from Element
fromSource

Holds if this element may be from source. This predicate holds for all elements, except for those in the dummy file, whose name is the empty string. The dummy file contains declarations that are built directly into the compiler.

from Element
getADeclaration

Gets a child declaration within this user-defined type.

from UserType
getADeclarationEntry

Gets a declaration entry corresponding to this declaration. See the comment above this class for an explanation of the relationship between Declaration and DeclarationEntry.

from UserType
getADeclarationLocation

Gets the location of a declaration entry corresponding to this declaration.

from UserType
getAFile

Gets a file where this element occurs.

from Declaration
getANameQualifier

Gets a name qualifier for which this is the qualifying namespace or user-defined type. For example: class X is the NameQualifyingElement and X:: is the NameQualifier.

from NameQualifyingElement
getAPrimaryQlClass

Gets the name of a primary CodeQL class to which this element belongs.

from UserType
getASpecifierfrom UserType
getATemplateArgument

Gets a template argument used to instantiate this declaration from a template. When called on a template, this will return a template parameter type for both typed and non-typed parameters.

from Declaration
getATemplateArgumentKind

Gets a template argument used to instantiate this declaration from a template. When called on a template, this will return a non-typed template parameter value.

from Declaration
getATypeNameUse

Gets as many places as possible where this type is used by name in the source after macros have been replaced (in particular, therefore, this will find type name uses caused by macros). Note that all type name uses within instantiations are currently excluded - this is too draconian in the absence of indexing prototype instantiations of functions, and is likely to improve in the future. At present, the method takes the conservative approach of giving valid type name uses, but not necessarily all type name uses.

from Type
getAlignment

Gets the alignment of this type in bytes.

from Type
getAnAttribute

Gets an attribute of this type.

from Type
getDeclaringType

Gets the class where this member is declared, if it is a member. For templates, both the template itself and all instantiations of the template are considered to have the same declaring class.

from Declaration
getDefinition

Gets the declaration entry corresponding to this declaration that is a definition, if any.

from UserType
getDefinitionLocation

Gets the location of the definition, if any.

from UserType
getDescription

Gets a description of this Declaration for display purposes.

from Declaration
getEnclosingAccessHolder

Gets the nearest enclosing AccessHolder.

from UserType
getEnclosingElement

Gets the closest Element enclosing this one.

from Element
getEnclosingFunction

Gets the function that directly encloses this type (if any).

from UserType
getFile

Gets the primary file where this element occurs.

from Element
getLocation

Gets the preferred location of this declaration, if any.

from UserType
getName

Gets the name of this type.

from UserType
getNamespace

Gets the innermost namespace which contains this declaration.

from Declaration
getNumberOfTemplateArguments

Gets the number of template arguments for this declaration.

from Declaration
getParentScope

Gets the parent scope of this Element, if any. A scope is a Type (Class / Enum), a Namespace, a BlockStmt, a Function, or certain kinds of Statement.

from Element
getPointerIndirectionLevel

Gets the pointer indirection level of this type.

from Type
getPrimaryQlClasses

Gets a comma-separated list of the names of the primary CodeQL classes to which this element belongs.

from ElementBase
getQualifiedName

Gets the name of the declaration, fully qualified with its namespace and declaring type.

from Declaration
getSimpleName

Gets the simple name of this type, without any template parameters. For example if the name of the type is "myType<int>", the simple name is just "myType".

from UserType
getSize

Gets the size of this type in bytes.

from Type
getTemplateArgument

Gets the ith template argument used to instantiate this declaration from a template.

from Declaration
getTemplateArgumentKind

Gets the ith template argument value used to instantiate this declaration from a template. When called on a template, this will return the ith template parameter value if it exists.

from Declaration
getUnderlyingType

Gets this type after typedefs have been resolved.

from Type
getUnspecifiedType

Gets this type after specifiers have been deeply stripped and typedefs have been resolved.

from Type
hasDeclaringType

Holds if this declaration is a member of a class/struct/union.

from Declaration
hasDefinition

Holds if the declaration has a definition.

from Declaration
hasGlobalName

Holds if this declaration has the given name in the global namespace.

from Declaration
hasGlobalOrStdName

Holds if this declaration has the given name in the global namespace or the std namespace.

from Declaration
hasGlobalOrStdOrBslName

Holds if this declaration has the given name in the global namespace, the std namespace or the bsl namespace. We treat std and bsl as the same in some of our models.

from Declaration
hasNamefrom UserType
hasQualifiedName

DEPRECATED: Prefer hasGlobalName or the 2-argument or 3-argument hasQualifiedName predicates. To get the exact same results as this predicate in all edge cases, use getQualifiedName().

from Declaration
hasQualifiedName

Holds if this declaration has a fully-qualified name with a name-space component of namespaceQualifier, no declaring type, and a base name of baseName.

from Declaration
hasQualifiedName

Holds if this declaration has a fully-qualified name with a name-space component of namespaceQualifier, a declaring type of typeQualifier, and a base name of baseName. Template parameters and arguments are stripped from all components. Missing components are "".

from Declaration
hasSpecifierfrom UserType
inMemberOrFriendOf

Holds if this can access private members of class c.

from AccessHolder
internal_getAnAdditionalSpecifier

Internal – should be protected when QL supports such a flag. Subtypes override this to recursively get specifiers that are not attached directly to this @type in the database but arise through type aliases such as typedef and decltype.

from Type
involvesReference

Holds if this type involves a reference.

from Type
involvesTemplateParameter

Holds if this type involves a template parameter.

from Type
isAffectedByMacro

Holds if this element is affected in any way by a macro. All elements that are totally or partially generated by a macro are included, so this is a super-set of isInMacroExpansion.

from Element
isAnonymous

Holds if this type is anonymous.

from UserType
isConst

Holds if this type is const.

from Type
isDeeplyConst

Holds if this type is constant and only contains constant types. For instance, a char *const is a constant type, but not deeply constant, because while the pointer can’t be modified the character can. The type const char *const* is a deeply constant type though - both the pointer and what it points to are immutable.

from Type
isDeeplyConstBelow

Holds if this type is constant and only contains constant types, excluding the type itself. It is implied by Type.isDeeplyConst() and is just used to implement that predicate. For example, const char *const is deeply constant and deeply constant below, but const char * is only deeply constant below (the pointer can be changed, but not the underlying char). char *const is neither (it is just const).

from Type
isDefined

DEPRECATED: Use hasDefinition instead.

from Declaration
isFromTemplateInstantiation

Holds if this Element is a part of a template instantiation (but not the template itself).

from Element
isFromUninstantiatedTemplate

Holds if this Element is part of a template template (not if it is part of an instantiation of template). This means it is represented in the database purely as syntax and without guarantees on the presence or correctness of type-based operations such as implicit conversions.

from Element
isInMacroExpansion

Holds if this element comes from a macro expansion. Only elements that are entirely generated by a macro are included - for elements that partially come from a macro, see isAffectedByMacro.

from Element
isLocal

Holds if this is a local type (that is, a type that has a directly-enclosing function).

from UserType
isMember

Holds if this declaration is a member of a class/struct/union.

from Declaration
isStatic

Holds if this declaration is static.

from Declaration
isTopLevel

Holds if this declaration is a top-level declaration.

from Declaration
isVolatile

Holds if this type is volatile.

from Type
refersTo

Holds if this type refers to type t (by default, a type always refers to itself).

from Type
refersToDirectly

Holds if this type refers to type t directly.

from Type
resolveTypedefs

Gets this type with any typedefs resolved. For example, given typedef C T, this would resolve const T& to const C&. Note that this will only work if the resolved type actually appears on its own elsewhere in the program.

from Type
stripTopLevelSpecifiers

Gets this type after any top-level specifiers and typedefs have been stripped.

from Type
stripType

Gets the type stripped of pointers, references and cv-qualifiers, and resolving typedefs. For example, given typedef const C&amp; T, stripType returns C.

from Type
toString

Gets a textual representation of this element.

from Declaration

Charpred