Cpp.AbstractArrayDeclarator Class
Namespace: Cpp
Superclasses: AstNodeProperties
Represents the abstract_array_declarator nodes in the syntax tree
of your code
Since R2026a
Description
The PQL class AbstractArrayDeclarator represents the node abstract_array_declarator in the syntax tree of your code.
int (*ptr_to_array)[10] = (int (*)[10]) (const int (*)[10])nullptr;;
The declaration (*)[10] in the preceding code is an
abstract_array_declarator and can be matched by this class.
Predicates
| Type | Raisable | Printable |
|---|---|---|
AbstractArrayDeclarator
| 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 AbstractArrayDeclarator &decl)
| Matches any abstract_array_declarator node and returns it in &decl; use this to directly select array declarator nodes. | This PQL defect checks for the presence of any
defect FindAnyAbstractArrayDeclarator =
when
Cpp.AbstractArrayDeclarator.is(&decl)
and decl.nodeText(&txt)
raise "Found abstract array declarator: \"{txt}\""
on declIn this C++ code, the defect finds each array declarator such as the omitted-first-dimension and multidimensional declarations.
int (*ptr_to_array)[10] = (int (*)[10]) (const int (*)[10])nullptr;; |
cast(Cpp.Node.Node node, required AbstractArrayDeclarator &cast)
| Checks whether a generic Cpp.Node.Node is an abstract_array_declarator; if so, returns the node as &cast for further array-specific predicates. | This PQL defect checks generic nodes and filters those that are
defect CastNodeToAbstractArray =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.AbstractArrayDeclarator.cast(node, &arr)
and arr.nodeText(&txt)
raise "Node is an abstract array declarator: \"{txt}\""
on arrIn this C++ code, the defect locates the
int (*ptr_to_array)[10] = (int (*)[10]) (const int (*)[10])nullptr;; |
isa(Cpp.Node.Node node)
| Tests whether a Cpp.Node.Node is an abstract_array_declarator; use in conditions or negations when you only need a boolean check. | This PQL defect checks generic nodes to see if they are
defect NodeIsAbstractArray =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.AbstractArrayDeclarator.isa(node)
raise "Node is an abstract array declarator"
on nodeIn this C++ code, the defect detects that the parsed
node corresponding to
int (*ptr_to_array)[10] = (int (*)[10]) (const int (*)[10])nullptr;; |
declarator(AbstractArrayDeclarator self, Cpp.Node.Node &child)
| Returns the nested declarator inside an abstract_array_declarator (e.g., the inner declarator when arrays are nested). | This PQL defect checks for the nested declarator node contained within an
defect FindNestedDeclarator =
when
Cpp.AbstractArrayDeclarator.is(&arr)
and arr.declarator(&inner)
and inner.nodeText(&txt)
raise "Nested declarator: \"{txt}\""
on arr |
size(AbstractArrayDeclarator self, Cpp.Node.Node &child)
| Selects the size-expression node inside an abstract_array_declarator (the expression or literal that specifies the array bound). | This PQL defect checks for the size expression (array bound) of an
defect FindArraySize =
when
Cpp.AbstractArrayDeclarator.is(&arr)
and arr.size(&sz)
and sz.nodeText(&txt)
raise "Array size expression: \"{txt}\""
on arrIn this C++ code, the defect matches the literal
int (*ptr_to_array)[10] = (int (*)[10]) (const int (*)[5])nullptr; |
typeQualifier(AbstractArrayDeclarator self, Cpp.Node.Node &child)
| Matches any type-qualifier token applied to the array size (e.g., const, volatile) and returns that qualifier node. | This PQL defect checks for type qualifiers applied to the array size expression. defect FindTypeQualifierInSize =
when
Cpp.AbstractArrayDeclarator.is(&arr)
and arr.typeQualifier(&tq)
and tq.nodeText(&txt)
raise "Array size type qualifier: \"{txt}\""
on tqIn this C++ code, the defect detects the
void function_declaration(int [const 10]); |
getEnclosingAbstractArrayDeclarator(Cpp.Node.Node child, required AbstractArrayDeclarator &parent)
| Finds the closest ancestor abstract_array_declarator that directly contains the given child node and returns it as &parent. | This PQL defect checks for the nearest enclosing
defect EnclosingAbstractArrayForSize =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.AbstractParenthesizedDeclarator.isa(node)
and Cpp.AbstractArrayDeclarator.getEnclosingAbstractArrayDeclarator(node, &parent)
and parent.nodeText(&txt)
raise "Enclosing abstract array declarator: \"{txt}\""
on parentIn this C++ code, there are two abstract
parenthesized declarators that have an abstract array declarator ancestor nodes:
int (*ptr_to_array)[10] = (int (*)[10]) (const int (*)[5])nullptr; |
isEnclosedInAbstractArrayDeclarator(Cpp.Node.Node child) | Matches every abstract_array_declarator ancestor of child; use to enumerate all array declarator ancestors rather than just the nearest one. | This PQL defect checks for all
ddefect AllEnclosingAbstractArrays =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.AbstractPointerDeclarator.isa(node)
and Cpp.AbstractArrayDeclarator.isEnclosedInAbstractArrayDeclarator(node)
and node.nodeText(&txt)
raise "Node with ancestor abstract array declarator: \"{txt}\""
on nodeIn this C++ code, there are two abstract pointer
declarators
int (*ptr_to_array)[10] = (int (*)[10]) (const int (*)[5])nullptr; |
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)