Ast.TypeQualifier Class
Namespace: Ast
Superclasses: AstNodeProperties
Represents the type_qualifier nodes in the syntax tree of your code
Since R2026a
Description
The PQL class Cpp.TypeQualifier represents the node type_qualifier in the syntax tree of your code.
#include <cstddef>
const int x = 5;
volatile int y;
alignas(16) int z;
int main() { return x + y + z; }The three declarations show const, volatile, and alignas(16) which correspond to type_qualifier nodes that Cpp.TypeQualifier models.
Predicates
| Type | Raisable | Printable |
|---|---|---|
TypeQualifier
| 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 TypeQualifier &qual)
| Matches a type_qualifier node and returns it as
qual. Use this to directly find qualifiers like const
volatile or alignas(...). | This PQL defect checks for any defect find_tq =
when
Cpp.TypeQualifier.is(&tq)
and tq.nodeText(&txt)
raise "Found type qualifier: \"{txt}\""
on tqIn this C++ code the defect finds occurrences of
type qualifiers such as
const int x = 5;
volatile int y;
alignas(16) int z;
int main() { return 0; } |
cast(Cpp.Node.Node node, required TypeQualifier &cast)
| Checks whether a given Node is a
type_qualifier and if so returns the node as
cast. Use this to confirm and extract a
type_qualifier from a generic node reference. | This PQL defect checks for a node that can be converted to a
defect cast_check =
when
Cpp.Node.is(&node, &,&,&)
and Cpp.TypeQualifier.cast(node, &tq2)
and tq2.nodeText(&txt)
raise "cast succeeded: \"{txt}\""
on tq2In this C++ code the defect finds type qualifiers by casting.
const int x = 5;
int main() { return x; } |
isa(Cpp.Node.Node node)
| Returns true if the given Node is a type_qualifier. Use this when you need to test the node kind without binding. | This PQL defect checks whether a previously obtained node is a
defect isa_check =
when
Cpp.Node.is(&node,&,&,&)
and Cpp.TypeQualifier.isa(node)
and tq.nodeText(&txt)
raise "isa true for: \"{txt}\""
on tqIn this C++ code the defect finds type qualifiers by boolean check.
volatile int y;
int main() { return y; } |
alignasQualifier(TypeQualifier self, Cpp.Node.Node &child)
| If self is an alignas(...) qualifier this
returns the alignas child node as child. Use
this to locate the alignas expression inside a qualifier. |
This PQL defect checks for defect find_alignas =
when
Cpp.TypeQualifier.is(&tq)
and tq.alignasQualifier(&aq)
and aq.nodeText(&txt)
raise "Found alignas qualifier: \"{txt}\""
on tqIn this C++ code the defect searches for the
#include <cstddef>
alignas(16) int z;
int main() { return z; } |
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)