CodeQL library for C/C++

Member predicate VariableDeclarationEntry::getName

Gets the name, if any, used for the variable at this declaration or definition.

In most cases, this will be the name of the variable itself. The only case in which it can differ is in a parameter declaration entry, because the parameter may have a different name in the declaration than in the definition. For example:

// Declaration. Parameter is named "x".
int f(int x);

// Definition. Parameter is named "y".
int f(int y) { return y; }
string getName()