brintos

brintos / llvm-project-archived public Read only

0
0
Text · 917 B · ac435af Raw
52 lines · plain
1.. title:: clang-tidy - readability-redundant-control-flow2 3readability-redundant-control-flow4==================================5 6This check looks for procedures (functions returning no value) with ``return``7statements at the end of the function. Such ``return`` statements are8redundant.9 10Loop statements (``for``, ``while``, ``do while``) are checked for redundant11``continue`` statements at the end of the loop body.12 13Examples:14 15The following function `f` contains a redundant ``return`` statement:16 17.. code-block:: c++18 19  extern void g();20  void f() {21    g();22    return;23  }24 25becomes26 27.. code-block:: c++28 29  extern void g();30  void f() {31    g();32  }33 34The following function `k` contains a redundant ``continue`` statement:35 36.. code-block:: c++37 38  void k() {39    for (int i = 0; i < 10; ++i) {40      continue;41    }42  }43 44becomes45 46.. code-block:: c++47 48  void k() {49    for (int i = 0; i < 10; ++i) {50    }51  }52