Class Declaration::Declaration
A C/C++ declaration: for example, a variable declaration, a type declaration, or a function declaration.
This file defines two closely related classes: Declaration
and
DeclarationEntry
. Some declarations do not correspond to a unique
location in the source code. For example, a global variable might
be declared in multiple source files:
extern int myglobal;
Each of these declarations is given its own distinct DeclarationEntry
,
but they all share the same Declaration
.
Some derived class of Declaration
do not have a corresponding
DeclarationEntry
, because they always have a unique source location.
EnumConstant
and FriendDecl
are both examples of this.
Direct supertypes
Indirect supertypes
Known direct subtypes
Predicates
getADeclarationEntry | Gets a declaration entry corresponding to this declaration. See the comment above this class for an explanation of the relationship between |
getADeclarationLocation | Gets the location of a declaration entry corresponding to this declaration. |
getAFile | Gets a file where this element occurs. |
getASpecifier | Gets a specifier of this declaration. |
getATemplateArgument | Gets a template argument used to instantiate this declaration from a template. When called on a template, this will return a template parameter. |
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. |
getDefinition | Gets the declaration entry corresponding to this declaration that is a definition, if any. |
getDefinitionLocation | Gets the location of the definition, if any. |
getLocation | Gets the preferred location of this declaration, if any. |
getName | Gets the name of this declaration. |
getNamespace | Gets the innermost namespace which contains this declaration. |
getNumberOfTemplateArguments | Gets the number of template arguments for this declaration. |
getQualifiedName | Gets the name of the declaration, fully qualified with its namespace and declaring type. |
getTemplateArgument | Gets the |
hasDeclaringType | Holds if this declaration is a member of a class/struct/union. |
hasDefinition | Holds if the declaration has a definition. |
hasGlobalName | Holds if this declaration has the given name in the global namespace. |
hasName | Holds if this declaration has the given name. |
hasQualifiedName | DEPRECATED: Prefer |
hasQualifiedName | Holds if this declaration has a fully-qualified name with a name-space component of |
hasQualifiedName | Holds if this declaration has a fully-qualified name with a name-space component of |
hasSpecifier | Holds if this declaration has a specifier with the given name. |
isDefined | |
isMember | Holds if this declaration is a member of a class/struct/union. |
isStatic | Holds if this declaration is static. |
isTopLevel | Holds if this declaration is a top-level declaration. |
toString | Gets a textual representation of this element. |
Inherited predicates
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 |
getCanonicalQLClass | Canonical QL class corresponding to this element. | from ElementBase |
getEnclosingElement | Gets the closest | from Element |
getFile | Gets the primary file where this element occurs. | from Element |
getParentScope | Gets the parent scope of this | from Element |
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 | from Element |
isFromTemplateInstantiation | Holds if this | from Element |
isFromUninstantiatedTemplate | Holds if this | 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 | from Element |