================ @@ -1432,34 +1432,82 @@ struct FormatStyle { /// const int i; /// [[gnu::const]] [[maybe_unused]] /// int j; + /// /// [[nodiscard]] /// inline int f(); /// [[gnu::const]] [[nodiscard]] /// int g(); + /// + /// [[likely]] + /// if (a) + /// f(); + /// else + /// g(); + /// + /// switch (b) { + /// [[unlikely]] + /// case 1: + /// ++b; + /// break; + /// [[likely]] + /// default: + /// return; + /// } /// \endcode ABS_Always, /// Leave the line breaking after attributes as is. /// \code /// [[maybe_unused]] const int i; /// [[gnu::const]] [[maybe_unused]] /// int j; + /// /// [[nodiscard]] inline int f(); /// [[gnu::const]] [[nodiscard]] /// int g(); + /// + /// [[likely]] if (a) + /// f(); + /// else + /// g(); + /// + /// switch (b) { + /// [[unlikely]] case 1: + /// ++b; + /// break; + /// [[likely]] + /// default: + /// return; + /// } /// \endcode ABS_Leave, /// Never break after attributes. /// \code /// [[maybe_unused]] const int i; /// [[gnu::const]] [[maybe_unused]] int j; + /// /// [[nodiscard]] inline int f(); /// [[gnu::const]] [[nodiscard]] int g(); + /// + /// [[likely]] if (a) + /// f(); + /// else + /// g(); + /// + /// switch (b) { + /// [[unlikely]] case 1: + /// ++b; + /// break; + /// [[likely]] default: + /// return; + /// } /// \endcode ABS_Never, }; - /// Break after a group of C++11 attributes before a variable/function - /// (including constructor/destructor) declaration/definition name. + /// Break after a group of C++11 attributes before variable or function + /// (including constructor/destructor) declaration/definition names or before + /// control statements, i.e. ``if``, ``switch`` (including ``case`` and + /// ``default``labels), ``for``, and ``while`` statements. ---------------- owenca wrote:
```suggestion /// ``default`` labels), ``for``, and ``while`` statements. ``` https://github.com/llvm/llvm-project/pull/71995 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits