Cpp.ParenthesizedDeclarator Class
Namespace: Cpp
Superclasses: AstNodeProperties
Represents the parenthesized_declarator nodes in the syntax tree of your code
Since R2026a
Description
The PQL class ParenthesizedDeclarator represents the node parenthesized_declarator in the syntax tree of your code.
// example.cpp
struct MyType { int (MyType::*m)(int); };
int (*f)[10];
int (*g)(int);
int (__stdcall *h)(int);
int main() {
(void)f; (void)g; (void)h;
return 0;
}The above C++ file contains several parenthesized_declarator
occurrences such as (*f)[10], (*g)(int) and
(__stdcall *h)(int). These nodes match the PQL
ParenthesizedDeclarator class.
Predicates
| Type | Raisable | Printable |
|---|---|---|
ParenthesizedDeclarator
| 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 ParenthesizedDeclarator &pd)
| Checks for a parenthesized_declarator node and returns it as pd; use this to directly select parenthesized declarators. |
This PQL defect checks for any defect parenthesized_found =
when
Cpp.ParenthesizedDeclarator.is(&pd)
raise "Found parenthesized declarator" on pdIn this C++ code, the defect finds occurrences like
int (*g)(int); int (*f)[10]; |
cast(Cpp.Node.Node node, required ParenthesizedDeclarator &cast)
| If node is a parenthesized_declarator, binds that node to cast for further inspection. |
This PQL defect checks whether a generic node is actually a defect cast_check =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.ParenthesizedDeclarator.cast(n, &pd)
raise "Node is a parenthesized_declarator" on pdIn this C++ code, the checker identifies
struct MyType { int (MyType::*m)(int); };
|
isa(Cpp.Node.Node node)
| Returns true if node is a parenthesized_declarator; useful for boolean checks or negation. |
This PQL defect checks nodes with a boolean test to see if they are defect isa_check =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.ParenthesizedDeclarator.isa(n)
raise "Node isa parenthesized_declarator" on nIn this C++ code, the predicate detects the
int (__stdcall *h)(int);
int main(){ (void)h; } |
fieldDeclarator(ParenthesizedDeclarator self, Cpp.Node.Node &child)
| Matches a field_declarator child inside a given
parenthesized_declarator. | This PQL defect checks for a defect field_decl_check =
when
Cpp.ParenthesizedDeclarator.is(&pd)
and pd.fieldDeclarator(&fd)
and fd.nodeText(&txt)
raise "Has field_declarator \"{txt}\" inside parenthesized_declarator"
on pd |
declarator(ParenthesizedDeclarator self, Cpp.Node.Node &child)
| Matches a declarator child inside the parenthesized_declarator (the identifier part). | This PQL defect checks for the inner defect inner_declarator_check =
when
Cpp.ParenthesizedDeclarator.is(&pd)
and pd.declarator(&d)
and d.nodeText(&txt)
raise "ParenthesizedDeclarator contains a declarator \"{txt}\""
on pd |
msCallModifier(ParenthesizedDeclarator self, Cpp.Node.Node &child)
| Matches a Microsoft calling-convention modifier (e.g., __stdcall) inside the parenthesized_declarator. | This PQL defect checks for MS calling-convention modifiers within a
defect mscc_check =
when
Cpp.ParenthesizedDeclarator.is(&pd)
and pd.msCallModifier(&mc)
and mc.nodeText(&txt)
raise "MS call modifier \"{txt}\" present in parenthesized_declarator" on pdIn
this C++ code,
int (__stdcall *h)(int);
int main(){ (void)h; } |
typeDeclarator(ParenthesizedDeclarator self, Cpp.Node.Node &child)
| Matches a type_declarator child inside a parenthesized_declarator, such as a MyType::* member-pointer form. | This PQL defect checks for a defect type_decl_check =
when
Cpp.ParenthesizedDeclarator.is(&pd)
and pd.typeDeclarator(&td)
and td.nodeText(&txt)
raise "Contains a type_declarator \"{txt}\"" on pdIn this
C++ code,
struct MyType { int (MyType::*m)(int); };
int main(){ MyType t; (void)t; } |
getEnclosingParenthesizedDeclarator(Cpp.Node.Node child, required ParenthesizedDeclarator &parent)
| Finds the nearest enclosing parenthesized_declarator ancestor of child and returns it as parent. | This PQL defect checks for the closest enclosing
defect enclosing_check =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.ParenthesizedDeclarator.getEnclosingParenthesizedDeclarator(n, &pd)
raise "Identifier is inside parenthesized_declarator" on pdIn
this C++ code, the identifier
int (*g)(int);
int main(){ (void)g; } |
isEnclosedInParenthesizedDeclarator(Cpp.Node.Node child)
| Matches every parenthesized_declarator ancestor of
child. | This PQL defect checks for any ancestor
defect all_enclosing_check =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.ParenthesizedDeclarator.isEnclosedInParenthesizedDeclarator(n)
raise "Identifier is enclosed by a parenthesized_declarator" on nIn
this C++ code, the identifier
struct MyType { int (MyType::*m)(int); };
int main(){ MyType t; (void)t; } |
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.
Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)