@@ -216,7 +216,13 @@ abstract class ConditionalStmt extends ControlStructure {
216216}
217217
218218/**
219- * A C/C++ 'if' statement.
219+ * A C/C++ 'if' statement. For example, the `if` statement in the following
220+ * code:
221+ * ```
222+ * if (x == 1) {
223+ * ...
224+ * }
225+ * ```
220226 */
221227class IfStmt extends ConditionalStmt , @stmt_if {
222228 override string getCanonicalQLClass ( ) { result = "IfStmt" }
@@ -295,7 +301,13 @@ class IfStmt extends ConditionalStmt, @stmt_if {
295301}
296302
297303/**
298- * A C/C++ 'constexpr if' statement.
304+ * A C/C++ 'constexpr if' statement. For example, the `if constexpr` statement
305+ * in the following code:
306+ * ```
307+ * if constexpr (x) {
308+ * ...
309+ * }
310+ * ```
299311 */
300312class ConstexprIfStmt extends ConditionalStmt , @stmt_constexpr_if {
301313
@@ -386,9 +398,11 @@ abstract class Loop extends ControlStructure {
386398/**
387399 * A C/C++ 'while' statement.
388400 *
389- * For example,
401+ * For example, the `while` statement in the following code:
390402 * ```
391- * while (b) { f(); }
403+ * while (b) {
404+ * f();
405+ * }
392406 * ```
393407 */
394408class WhileStmt extends Loop , @stmt_while {
@@ -468,9 +482,11 @@ abstract class JumpStmt extends Stmt, @jump {
468482/**
469483 * A C/C++ 'goto' statement which jumps to a label.
470484 *
471- * For example,
485+ * For example, the `goto` statement in the following code:
472486 * ```
473487 * goto someLabel;
488+ * ...
489+ * somelabel:
474490 * ```
475491 */
476492class GotoStmt extends JumpStmt , @stmt_goto {
@@ -525,7 +541,7 @@ class GotoStmt extends JumpStmt, @stmt_goto {
525541 * A 'goto' statement whose target is computed by a non-constant
526542 * expression (a non-standard extension to C/C++).
527543 *
528- * For example,
544+ * For example, the `goto` statement in the following code:
529545 * ```
530546 * goto *ptr;
531547 * ```
@@ -560,9 +576,12 @@ class ComputedGotoStmt extends Stmt, @stmt_assigned_goto {
560576/**
561577 * A C/C++ 'continue' statement.
562578 *
563- * For example,
579+ * For example, the `continue` statement in the following code:
564580 * ```
565- * continue;
581+ * while (x) {
582+ * if (arr[x] < 0) continue;
583+ * ...
584+ * }
566585 * ```
567586 */
568587class ContinueStmt extends JumpStmt , @stmt_continue {
@@ -590,9 +609,12 @@ private Stmt getEnclosingContinuable(Stmt s) {
590609/**
591610 * A C/C++ 'break' statement.
592611 *
593- * For example,
612+ * For example, the `break` statement in the following code:
594613 * ```
595- * break;
614+ * while (x) {
615+ * if (arr[x] == 0) break;
616+ * ...
617+ * }
596618 * ```
597619 */
598620class BreakStmt extends JumpStmt , @stmt_break {
@@ -620,9 +642,11 @@ private Stmt getEnclosingBreakable(Stmt s) {
620642/**
621643 * A C/C++ 'label' statement.
622644 *
623- * For example,
645+ * For example, the `somelabel:` statement in the following code:
624646 * ```
625- * someLabel:
647+ * goto someLabel;
648+ * ...
649+ * somelabel:
626650 * ```
627651 */
628652class LabelStmt extends Stmt , @stmt_label {
@@ -643,7 +667,7 @@ class LabelStmt extends Stmt, @stmt_label {
643667/**
644668 * A C/C++ 'return' statement.
645669 *
646- * For example,
670+ * For example:
647671 * ```
648672 * return 1+2;
649673 * ```
@@ -696,7 +720,7 @@ class ReturnStmt extends Stmt, @stmt_return {
696720/**
697721 * A C/C++ 'do' statement.
698722 *
699- * For example,
723+ * For example, the `do` ... `while` in the following code:
700724 * ```
701725 * do {
702726 * x = x + 1;
@@ -838,7 +862,7 @@ class RangeBasedForStmt extends Loop, @stmt_range_based_for {
838862 * This only represents "traditional" 'for' statements and not C++11
839863 * range-based 'for' statements or Objective C 'for-in' statements.
840864 *
841- * For example,
865+ * For example, the `for` statement in:
842866 * ```
843867 * for (i = 0; i < 10; i++) { j++; }
844868 * ```
@@ -1061,13 +1085,15 @@ private predicate inForUpdate(Expr forUpdate, Expr child) {
10611085/**
10621086 * A C/C++ 'switch case' statement.
10631087 *
1064- * For example,
1088+ * For example, the `case` and `default` statements in:
10651089 * ```
1090+ * switch (i)
1091+ * {
10661092 * case 5:
1067- * ```
1068- * or
1069- * ```
1093+ * ...
10701094 * default:
1095+ * ...
1096+ * }
10711097 * ```
10721098 */
10731099class SwitchCase extends Stmt , @stmt_switch_case {
@@ -1399,9 +1425,15 @@ class SwitchCase extends Stmt, @stmt_switch_case {
13991425/**
14001426 * A C/C++ 'default case' statement.
14011427 *
1402- * For example,
1428+ * For example, the `default` statement in:
14031429 * ```
1430+ * switch (i)
1431+ * {
1432+ * case 5:
1433+ * ...
14041434 * default:
1435+ * ...
1436+ * }
14051437 * ```
14061438 */
14071439class DefaultCase extends SwitchCase {
@@ -1421,14 +1453,14 @@ class DefaultCase extends SwitchCase {
14211453/**
14221454 * A C/C++ 'switch' statement.
14231455 *
1424- * For example,
1456+ * For example, the `switch` statement in:
14251457 * ```
1426- * switch(i) {
1427- * case 1:
1428- * case 2 :
1429- * break;
1430- * default:
1431- * break;
1458+ * switch (i)
1459+ * {
1460+ * case 5 :
1461+ * ...
1462+ * default:
1463+ * ...
14321464 * }
14331465 * ```
14341466 */
@@ -1575,7 +1607,7 @@ class SwitchStmt extends ConditionalStmt, @stmt_switch {
15751607 * enum color { RED, GREEN, BLUE };
15761608 * enum color c;
15771609 * ```
1578- * the ' switch' statement
1610+ * the ` switch` statement in:
15791611 * ```
15801612 * switch (c) {
15811613 * case RED:
@@ -1639,7 +1671,16 @@ class EnumSwitch extends SwitchStmt {
16391671 * execution continues with the next `Handler`.
16401672 *
16411673 * This has no concrete representation in the source, but makes the
1642- * control flow graph easier to use.
1674+ * control flow graph easier to use. For example in the following code:
1675+ * ```
1676+ * try
1677+ * {
1678+ * f();
1679+ * } catch (std::exception &e) {
1680+ * g();
1681+ * }
1682+ * there is a handler that's associated with the `catch` block and controls
1683+ * entry to it.
16431684 */
16441685class Handler extends Stmt , @stmt_handler {
16451686
@@ -1694,9 +1735,13 @@ deprecated class FinallyEnd extends Stmt {
16941735/**
16951736 * A C/C++ 'try' statement.
16961737 *
1697- * For example,
1738+ * For example, the `try` statement in the following code:
16981739 * ```
1699- * try { f(); } catch (...) { g(); }
1740+ * try {
1741+ * f();
1742+ * } catch(std::exception &e) {
1743+ * g();
1744+ * }
17001745 * ```
17011746 */
17021747class TryStmt extends Stmt , @stmt_try_block {
@@ -1766,7 +1811,7 @@ class TryStmt extends Stmt, @stmt_try_block {
17661811 * A C++ 'function try' statement.
17671812 *
17681813 * This is a 'try' statement wrapped around an entire function body,
1769- * for example:
1814+ * for example the `try` statement in the following code :
17701815 * ```
17711816 * void foo() try {
17721817 * f();
@@ -1784,7 +1829,17 @@ class FunctionTryStmt extends TryStmt {
17841829}
17851830
17861831/**
1787- * A 'catch block', from either C++'s `catch` or Objective C's `@catch`.
1832+ * A 'catch block', for example the second and third blocks in the following
1833+ * code:
1834+ * ```
1835+ * try {
1836+ * f();
1837+ * } catch(std::exception &e) {
1838+ * g();
1839+ * } catch(...) {
1840+ * h();
1841+ * }
1842+ * ```
17881843 */
17891844class CatchBlock extends Block {
17901845
@@ -1807,7 +1862,16 @@ class CatchBlock extends Block {
18071862}
18081863
18091864/**
1810- * A C++ 'catch-any block', that is, `catch(...) {stmts}`.
1865+ * A C++ 'catch-any block', for example the third block in the following code:
1866+ * ```
1867+ * try {
1868+ * f();
1869+ * } catch(std::exception &e) {
1870+ * g();
1871+ * } catch(...) {
1872+ * h();
1873+ * }
1874+ * ```
18111875 */
18121876class CatchAnyBlock extends CatchBlock {
18131877 CatchAnyBlock ( ) {
@@ -1828,8 +1892,17 @@ class MicrosoftTryStmt extends Stmt, @stmt_microsoft_try {
18281892}
18291893
18301894/**
1831- * A structured exception handling 'try except' statement, that is,
1832- * a `__try __except` statement. This is a Microsoft C/C++ extension.
1895+ * A structured exception handling 'try except' statement, for example the
1896+ * `__try` statement in the following code:
1897+ * ```
1898+ * __try
1899+ * {
1900+ * f();
1901+ * } __except(myExceptionFilter()) {
1902+ * g()
1903+ * }
1904+ * ```
1905+ * This is a Microsoft C/C++ extension.
18331906 */
18341907class MicrosoftTryExceptStmt extends MicrosoftTryStmt {
18351908 MicrosoftTryExceptStmt ( ) {
@@ -1850,8 +1923,17 @@ class MicrosoftTryExceptStmt extends MicrosoftTryStmt {
18501923}
18511924
18521925/**
1853- * A structured exception handling 'try finally' statement, that is,
1854- * a `__try __finally` statement. This is a Microsoft C/C++ extension.
1926+ * A structured exception handling 'try finally' statement, for example the
1927+ * `__try` statement in the following code:
1928+ * ```
1929+ * __try
1930+ * {
1931+ * f();
1932+ * } __finally {
1933+ * g()
1934+ * }
1935+ * ```
1936+ * This is a Microsoft C/C++ extension.
18551937 */
18561938class MicrosoftTryFinallyStmt extends MicrosoftTryStmt {
18571939 MicrosoftTryFinallyStmt ( ) {
@@ -1869,7 +1951,7 @@ class MicrosoftTryFinallyStmt extends MicrosoftTryStmt {
18691951/**
18701952 * A C/C++ 'declaration' statement.
18711953 *
1872- * For example,
1954+ * For example, the following statement is a declaration statement:
18731955 * ```
18741956 * int i, j;
18751957 * ```
@@ -1950,7 +2032,7 @@ class DeclStmt extends Stmt, @stmt_decl {
19502032/**
19512033 * A C/C++ 'empty' statement.
19522034 *
1953- * For example,
2035+ * For example, the following statement is an empty statement:
19542036 * ```
19552037 * ;
19562038 * ```
@@ -1968,7 +2050,7 @@ class EmptyStmt extends Stmt, @stmt_empty {
19682050/**
19692051 * A C/C++ 'asm' statement.
19702052 *
1971- * For example,
2053+ * For example, the `__asm__` statement in the following code:
19722054 * ```
19732055 * __asm__("movb %bh (%eax)");
19742056 * ```
@@ -1982,8 +2064,12 @@ class AsmStmt extends Stmt, @stmt_asm {
19822064}
19832065
19842066/**
1985- * A C99 statement which computes the size of a single dimension of
1986- * a variable length array.
2067+ * A C99 statement which computes the size of a single dimension of a
2068+ * variable length array. For example the variable length array dimension
2069+ * (`x`) in the following code:
2070+ * ```
2071+ * int myArray[x];
2072+ * ```
19872073 *
19882074 * Each `VlaDeclStmt` is preceded by one `VlaDimensionStmt` for each
19892075 * variable length dimension of the array.
@@ -1998,7 +2084,11 @@ class VlaDimensionStmt extends Stmt, @stmt_set_vla_size {
19982084}
19992085
20002086/**
2001- * A C99 statement which declares a variable length array.
2087+ * A C99 statement which declares a variable length array. For example
2088+ * the variable length array declaration in the following code:
2089+ * ```
2090+ * int myArray[x];
2091+ * ```
20022092 *
20032093 * Each `VlaDeclStmt` is preceded by one `VlaDimensionStmt` for each
20042094 * variable length dimension of the array.
0 commit comments