Cpp.AbstractFunctionDeclarator Class
Namespace: Cpp
Superclasses: AstNodeProperties
Represents the abstract_function_declarator nodes in the syntax
tree of your code
Since R2026a
Description
The PQL class AbstractFunctionDeclarator represents the node abstract_function_declarator in the syntax tree of your code.
// Examples that produce abstract function declarator forms: void runner(int(int));
The snippets above include int(int) which is an
abstract_function_declarator node matched by this PQL class.
Predicates
| Type | Raisable | Printable |
|---|---|---|
AbstractFunctionDeclarator
| Yes | No |
This class defines these predicates that act on the objects of this class. In addition, objects of this class can access the predicates defined by the base class AstNodeProperties. An object of this class is an object of AstNodeProperties class.
| Predicates | Description | Example |
|---|---|---|
is(required AbstractFunctionDeclarator &decl)
| Matches any abstract_function_declarator node and returns it as decl; use to find all such declarators. | This PQL defect checks for any
defect findAnyAbstractFunctionDeclarator =
when
Cpp.AbstractFunctionDeclarator.is(&decl)
raise "Found abstract function declarator"
on declIn this C++ code, the defect finds a the nameless
function declarator
void execute_callback(int (*)(float)); //matches abstract function declarator |
cast(Cpp.Node.Node node, required AbstractFunctionDeclarator &cast)
| Checks whether a generic node is an abstract_function_declarator, and if so returns it as cast for further predicates. | This PQL defect checks whether a general node is an
defect castNodeToAbstract =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.AbstractFunctionDeclarator.cast(n, &afd)
raise "Node cast to AbstractFunctionDeclarator"
on afdIn this C++ code, the defect finds the node that can be cast to asbtract functon declarator.
void execute_callback(int (*)(float)); |
isa(Cpp.Node.Node node)
| True if node is an abstract_function_declarator; useful for existence checks or negation. | This PQL defect checks for nodes that are specifically
defect checkIsa =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.AbstractFunctionDeclarator.isa(n)
raise "Node is an AbstractFunctionDeclarator"
on nIn this C++ code, the predicate detects the abstract function declarator node.
void execute_callback(int (*)(float)); |
declarator(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Returns the nested declarator component of the abstract function declarator. | This PQL defect checks for the inner defect findInnerDeclarator =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.declarator(&inner)
and inner.nodeText(&txt)
raise "Found inner declarator: \"{txt}\""
on afdIn this C++ code, the predicate extracts the
void execute_callback(int (*)(float)); |
parameters(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches the parameter list node (the parenthesized parameter types) of the function declarator. | This PQL defect checks for the parameters defect findParameters =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.parameters(¶ms)
and params.nodeText(&txt)
raise "Parameters found: \"{txt}\""
on paramsIn this C++ code, the predicate identifies the
parameter list
void execute_callback(int (*)(int, float)); |
trailingReturnType(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches a trailing return type node (the -> type clause) on a function declarator. | This PQL defect checks for a defect findTrailingReturn =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.trailingReturnType(&tr)
and tr.nodeText(&txt)
raise "Trailing return type: \"{txt}\""
on trIn this C++ code, the pql defect finds the
void execute_callback(auto (*)(int, float) -> int); |
gnuAsmExpression(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches a GCC __asm__(...) expression attached to a declarator (GNU extension). | This PQL defect checks for a GNU defect findGnuAsm =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.gnuAsmExpression(&asm)
raise "GNU asm expression present"
on asm |
typeQualifier(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches a type qualifier on the function declarator such as const or volatile. | This PQL defect checks for
defect findTypeQualifier =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.typeQualifier(&tq)
and tq.nodeText(&txt)
raise "Type qualifier of abstract function declarator: \"{txt}\""
on tqIn this C++ code, the predicate finds the
class MyClass {
// Defines a function type: 'Function taking (int, float) and returning int'
// This function can be called on a const MyClass object.
using ConstFuncType = int(int, float) const;
}; |
noexcept(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches the noexcept specifier (with or without an expression) on the declarator. | This PQL defect checks for defect findNoexcept =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.noexcept(&ne)
raise "noexcept present"
on neIn this C++ code, the predicate detects the
class MyClass {
// Defines a function type: 'Function taking (int, float) and returning int'
// This function can be called on a const MyClass object.
using ConstFuncType = int(int, float) noexcept;
}; |
virtualSpecifier(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches virtual-specifier tokens for overridden/virtual-related specifiers like override or final. | This PQL defect checks for
defect findVirtualSpecifier =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.virtualSpecifier(&vs)
raise "Virtual specifier present"
on vsIn this C++ code, the predicate finds the
class MyClass {
using ConstFuncType = int(int, float) override;
}; |
refQualifier(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches reference qualifiers on member functions such as & or &&. | This PQL defect checks for defect findRefQualifier =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.refQualifier(&rq)
raise "Ref qualifier present"
on rqIn this C++ code, the defect detects the
class MyClass {
public:
// This defines a function type (no name) that can only be called
// on a persistent (lvalue) instance of MyClass.
using LValueOnlyFuncType = void(int) &; // macthes the &
// This defines a function type that can only be called
// on a temporary (rvalue) instance of MyClass.
using RValueOnlyFuncType = int() &&; // matches the &&
}; |
requiresClause(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches C++20 requires(...) clauses attached to the function declarator. | This PQL defect checks for defect findRequiresClause =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.requiresClause(&rc)
raise "Requires clause present"
on rcIn this C++ code, the defect finds the
template <typename T>
class Caller {
// This defines a function type (no name) that includes a requires clause.
// The declarator for this type alias is the abstract function declarator.
using CallableType = void(int) requires std::is_integral_v<T>;
}; |
attributeDeclaration(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches C++11-style attribute-declaration syntax following the declarator, like [[nodiscard]]. | This PQL defect checks for attribute declarations attached to function declarators. defect findAttributeDeclaration =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.attributeDeclaration(&ad)
raise "Attribute declaration present"
on adIn this C++ code, the defect detects
void execute_callback(auto (*)(int, float) [[nodiscard]] -> int); |
throwSpecifier(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches the deprecated throw(type) exception-specifier attached to a function declarator. |
This PQL defect checks for old-style defect findThrowSpecifier =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.throwSpecifier(&ts)
raise "Throw specifier present"
on tsIn this C++ code, the predicate finds the
class LegacyCode {
public:
// This defines an abstract function type (using alias)
// with a throw specification listing 'int'.
using LegacyCallbackType = int(float) throw(int);
}; |
attributeSpecifier(AbstractFunctionDeclarator self, Cpp.Node.Node &child)
| Matches individual attribute-specifier sequences (e.g., [[noreturn]]) associated with the declarator. | This PQL defect checks for attribute specifiers (single attribute groups) on function declarators. defect findAttributeSpecifier =
when
Cpp.AbstractFunctionDeclarator.is(&afd)
and afd.attributeSpecifier(&as)
raise "Attribute specifier present"
on as |
getEnclosingAbstractFunctionDeclarator(Cpp.Node.Node child, required AbstractFunctionDeclarator &parent)
| Returns the nearest enclosing abstract_function_declarator ancestor of the given child node as parent. | This PQL defect checks for the closest enclosing
defect findEnclosingAbstract =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.TypeDescriptor.isa(n)
and Cpp.AbstractFunctionDeclarator.getEnclosingAbstractFunctionDeclarator(n, &parent)
raise "Found enclosing abstract function declarator"
on parentIn this C++ code, the defect reports the abstract
function declarator that is the parent node of the type descriptor
class LegacyCode {
public:
// This defines an abstract function type (using alias)
// with a throw specification listing 'int'.
using LegacyCallbackTypeA = int(float) throw(int); //macthes
using LegacyCallbackTypeB = int(float) throw(); // does not macth
}; |
isEnclosedInAbstractFunctionDeclarator(Cpp.Node.Node
child) | Matches any abstract_function_declarator ancestor (not only the nearest) that encloses child, returning each matching parent. | This PQL defect checks for any ancestor
defect findAllEnclosingAbstracts =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.TypeDescriptor.isa(n)
and Cpp.AbstractFunctionDeclarator.isEnclosedInAbstractFunctionDeclarator(n)
raise "Node with enclosing abstract function declarator present"
on nIn this C++ code, the defect finds all enclosing declarators for the parameter node of a nested function pointer.
class LegacyCode {
public:
// This defines an abstract function type (using alias)
// with a throw specification listing 'int'.
using LegacyCallbackType = int(float) throw(int); // matches
int foo(float) throw(int); // does not match
}; |
Version History
Introduced in R2026a
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)