Class Field::Field

A C structure member or C++ non-static member variable. For example the member variable m in the following code (but not s):

class MyClass {
public:
  int m;
  static int s;
};

This does not include static member variables in C++. To include static member variables, use MemberVariable instead of Field.

Direct supertypes

Indirect supertypes

Known direct subtypes

Predicates

getAByteOffsetIn

Gets the byte offset within mostDerivedClass of each occurence of this field within mostDerivedClass itself or a base class subobject of mostDerivedClass. Note that for fields of virtual base classes, and non-virtual base classes thereof, this predicate assumes that mostDerivedClass is the type of the complete most-derived object.

getByteOffset

Gets the offset of this field in bytes from the start of its declaring type (on the machine where facts were extracted).

getInitializationOrder

Gets the zero-based index of the specified field within its enclosing class, counting only fields that can be initialized. This is the order in which the field will be initialized, whether by an initializer list or in a constructor.

isInitializable

Holds if the field can be initialized as part of an initializer list. For example, in: struct S { unsigned int a : 5; unsigned int : 5; unsigned int b : 5; };

Inherited predicates

declaredUsingAutoType

Holds if the type of this variable is declared using the C++ auto keyword.

from Variable
findRootCause

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

from Element
fromLibrary

Holds if this element may be from a library.

from Element
fromSource

Holds if this element may be from source.

from Element
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 Variable
getADeclarationLocation

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

from Variable
getAFile

Gets a file where this element occurs.

from Declaration
getASpecifier

Gets a specifier of this variable. This includes extern, static, auto, private, protected, public. Specifiers of the type of this variable, such as const and volatile, are instead accessed through this.getType().getASpecifier().

from Variable
getATemplateArgument

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

from Declaration
getAnAccess

Gets an access to this variable.

from Variable
getAnAssignedValue

Gets an expression that is assigned to this variable somewhere in the program.

from Variable
getAnAssignment

Gets an assignment expression that assigns to this variable. For example: x=... or x+=....

from Variable
getAnAttribute

Gets an attribute of this variable.

from Variable
getCanonicalQLClass

Canonical QL class corresponding to this element.

from ElementBase
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 Variable
getDefinitionLocation

Gets the location of the definition, if any.

from Variable
getEnclosingElement

Gets the closest Element enclosing this one.

from Element
getFile

Gets the primary file where this element occurs.

from Element
getInitializer

Gets the initializer of this variable, if any.

from Variable
getLocation

Gets the preferred location of this declaration, if any.

from Variable
getName

Gets the name of this variable.

from MemberVariable
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 Block, a Function, or certain kinds of Statement.

from Element
getQualifiedName

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

from Declaration
getTemplateArgument

Gets the ith template argument used to instantiate this variable from a variable template. When called on a variable template, this will return the ith template parameter.

from Variable
getType

Gets the type of this variable.

from MemberVariable
getTypeWithAuto

Gets the type of this variable prior to deduction caused by the C++11 auto keyword.

from Variable
getUnderlyingType

Gets the type of this variable, after typedefs have been resolved.

from Variable
getUnspecifiedType

Gets the type of this variable, after specifiers have been deeply stripped and typedefs have been resolved.

from Variable
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
hasInitializer

Holds if this variable has an initializer.

from Variable
hasName

Holds if this declaration has the given name.

from Declaration
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, 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
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
hasSpecifier

Holds if this declaration has a specifier with the given name.

from Declaration
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
isCompilerGenerated

Holds if this is a compiler-generated variable. For example, a range-based for loop typically has three compiler-generated variables, named __range, __begin, and __end:

from Variable
isConst

Holds if this variable is const.

from Variable
isConstexpr

Holds if this variable is constexpr.

from Variable
isConstructedFrom

Holds if this variable is constructed from v as a result of template instantiation. If so, it originates either from a template variable or from a variable nested in a template class.

from Variable
isDefinedfrom 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
isMember

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

from Declaration
isMutable

Holds if this member is mutable.

from MemberVariable
isPrivate

Holds if this member is private.

from MemberVariable
isProtected

Holds if this member is protected.

from MemberVariable
isPublic

Holds if this member is public.

from MemberVariable
isStatic

Holds if this declaration is static.

from Declaration
isThreadLocal

Holds if this variable is thread_local.

from Variable
isTopLevel

Holds if this declaration is a top-level declaration.

from Declaration
isVolatile

Holds if this variable is volatile.

from Variable
toString

Gets a textual representation of this element.

from Declaration

Charpred