Cpp.DestructorName Class
Namespace: Cpp
Superclasses: AstNodeProperties
Represents the destructor_name nodes in the syntax tree of your code
Since R2026a
Description
The PQL class DestructorName represents the node destructor_name in the syntax tree of your code.
struct Foo {
~Foo();
};
void test() {
Foo f;
f.~Foo();
}The ~Foo tokens in the code produce destructor_name nodes; both the declaration ~Foo() and the explicit call f.~Foo() contain destructor_name in the tree.
Predicates
| Type | Raisable | Printable |
|---|---|---|
DestructorName
| 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 DestructorName &dn)
| Matches any destructor_name node and returns it as dn, useful to directly select destructor-name occurrences. |
This PQL defect checks for any defect find_destructor_name =
when
Cpp.DestructorName.is(&dn)
and dn.nodeText(&txt)
raise "found destructor name: \"{txt}\""
on dnIn this C++ code, the defect finds the
struct Foo { ~Foo(); };
void f() { Foo x; x.~Foo(); } |
cast(Cpp.Node.Node node, required DestructorName &cast)
| Checks whether an arbitrary Cpp.Node.Node is a
destructor_name. If so, returns the node as
destructor_name for further analysis. |
This PQL defect checks whether a generic node is specifically a defect cast_to_destructor =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.DestructorName.cast(node, &dn)
and dn.nodeText(&txt)
raise "node is destructor_name: \"{txt}\""
on dnIn this C++ code, the defect inspects generic nodes and identifies the nodes corresponding to the destructor call
struct Foo { ~Foo(); };
void g() { Foo x; x.~Foo(); } |
isa(Cpp.Node.Node node)
| Returns true when the given Cpp.Node.Node is a
destructor_name. Useful for boolean checks or
negations. |
This PQL defect checks for nodes that are defect isa_test =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.DestructorName.isa(node)
raise "node isa destructor_name"
on nodeIn this C++ code, the defect will trigger for the
struct Foo { ~Foo(); };
void h() { Foo a; a.~Foo(); } |
identifier(DestructorName self, Cpp.Node.Node &child)
| Selects the child identifier node inside a
destructor_name , returning it as
child. |
This PQL defect checks for the defect destructor_identifier =
when
Cpp.DestructorName.is(&dn)
and dn.identifier(&id)
and id.nodeText(&txt)
raise "destructor identifier: \"{txt}\""
on dnIn this C++ code, the defect extracts
struct Foo { ~Foo(); };
void k() { Foo v; v.~Foo(); } |
getEnclosingDestructorName(Cpp.Node.Node child, required DestructorName &parent)
| Finds the nearest ancestor destructor_name node that encloses child, returning it as parent. | This PQL defect checks for nodes that are inside a
defect enclosing_destructor =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.DestructorName.getEnclosingDestructorName(n, &dn)
and dn.nodeText(&txt)
raise "identifier is inside destructor_name: \"{txt}\""
on nIn this C++ code, the defect locates the child
nodes of the
struct Foo { ~Foo(); };
void m() { Foo u; u.~Foo(); } |
isEnclosedInDestructorName(Cpp.Node.Node child)
| Matches every destructor_name ancestor
parent of child. | This PQL defect checks for all defect all_enclosing_destructors =
when
Cpp.Node.is(&n, &,&,&)
and Cpp.DestructorName.isEnclosedInDestructorName(n)
and n.nodeText(&txt)
raise "Node has ancestor destructor_name: \"{txt}\""
on nIn this C++ code, the defect locates the descendent
nodes of the
struct Foo { ~Foo(); };
void n() { Foo z; z.~Foo(); } |
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.
Seleziona un sito web
Seleziona un sito web per visualizzare contenuto tradotto dove disponibile e vedere eventi e offerte locali. In base alla tua area geografica, ti consigliamo di selezionare: .
Puoi anche selezionare un sito web dal seguente elenco:
Come ottenere le migliori prestazioni del sito
Per ottenere le migliori prestazioni del sito, seleziona il sito cinese (in cinese o in inglese). I siti MathWorks per gli altri paesi non sono ottimizzati per essere visitati dalla tua area geografica.
Americhe
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- 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)