[flang] Extend documentation

Original-commit: flang-compiler/f18@7e11f8165f
Reviewed-on: https://github.com/flang-compiler/f18/pull/774
Tree-same-pre-rewrite: false
This commit is contained in:
peter klausler 2019-10-02 16:30:36 -07:00
parent e88bf15d2a
commit 07d48c0a23
1 changed files with 4 additions and 0 deletions

View File

@ -171,6 +171,10 @@ We have an `ENUM_CLASS` macro that helps capture the names of constants.
explicitly, it should contain either a `default:;` at its end or a
`default:` label that obviously crashes; we have a `CRASH_NO_CASE` macro
for such situations.
1. On the other hand, when a `switch()` statement really does cover all of
the values of an `enum class`, please insert a call to the `SWITCH_COVERS_ALL_CASES`
macro at the top of the block. This macro does the right thing for G++ and
clang to ensure that no warning is emitted when the cases are indeed all covered.
1. When using `std::optional` values, avoid unprotected access to their content.
This is usually by means of `x.has_value()` guarding execution of `*x`.
This is implicit when they are function results assigned to local variables