mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
C++: add getUnspecifiedType() for exprs and decls
This commit is contained in:
@@ -270,6 +270,16 @@ abstract class DeclarationEntry extends Locatable {
|
||||
*/
|
||||
abstract Type getType();
|
||||
|
||||
/**
|
||||
* Gets the type associated with this declaration entrry after specifiers
|
||||
* have been deeply stripped and typedefs have been resolved.
|
||||
*
|
||||
* For variable declarations, get the type of the variable.
|
||||
* For function declarations, get the return type of the function.
|
||||
* For type declarations, get the type being declared.
|
||||
*/
|
||||
Type getUnspecifiedType() { result = this.getType().getUnspecifiedType() }
|
||||
|
||||
/**
|
||||
* Holds if this declaration entry has a specifier with the given name.
|
||||
*/
|
||||
|
||||
@@ -133,6 +133,12 @@ class Function extends Declaration, ControlFlowNode, AccessHolder, @function {
|
||||
/** Gets the return type of this function. */
|
||||
Type getType() { function_return_type(underlyingElement(this),unresolveElement(result)) }
|
||||
|
||||
/**
|
||||
* Gets the return type of this function after specifiers have been deeply
|
||||
* stripped and typedefs have been resolved.
|
||||
*/
|
||||
Type getUnspecifiedType() { result = getType().getUnspecifiedType() }
|
||||
|
||||
/** Gets the nth parameter of this function. */
|
||||
Parameter getParameter(int n) { params(unresolveElement(result),underlyingElement(this),n,_) }
|
||||
|
||||
|
||||
@@ -47,6 +47,12 @@ class Variable extends Declaration, @variable {
|
||||
/** Gets the type of this variable, after typedefs have been resolved. */
|
||||
Type getUnderlyingType() { result = this.getType().getUnderlyingType() }
|
||||
|
||||
/**
|
||||
* Gets the type of this variable, after specifiers have been deeply
|
||||
* stripped and typedefs have been resolved.
|
||||
*/
|
||||
Type getUnspecifiedType() { result = this.getType().getUnspecifiedType() }
|
||||
|
||||
/**
|
||||
* Gets the type of this variable prior to deduction caused by the C++11
|
||||
* `auto` keyword.
|
||||
|
||||
@@ -68,6 +68,16 @@ class Expr extends StmtParent, @expr {
|
||||
*/
|
||||
Type getUnderlyingType() { result = this.getType().getUnderlyingType() }
|
||||
|
||||
/**
|
||||
* Gets the type of this expression after specifiers have been deeply
|
||||
* stripped and typedefs have been resolved.
|
||||
*
|
||||
* In most cases, this predicate will be the same as getType(). It will
|
||||
* only differ when the result of getType() is a TypedefType, in which
|
||||
* case this predicate will (possibly recursively) resolve the typedef.
|
||||
*/
|
||||
Type getUnspecifiedType() { result = this.getType().getUnspecifiedType() }
|
||||
|
||||
/**
|
||||
* Gets an integer indicating the type of expression that this represents.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user