[flang] Add clang-tidy check for braces around if
authorDiana Picus <diana.picus@linaro.org>
Fri, 11 Jun 2021 09:07:23 +0000 (09:07 +0000)
committerDiana Picus <diana.picus@linaro.org>
Wed, 16 Jun 2021 09:13:53 +0000 (09:13 +0000)
commit45cd405dc07bbc259ea251c8f5f5e2bca7a6112c
tree854fdde21eff98df1d9b65131c28148d6c4aae85
parent29843cbc88f6f91bc8eb350f847a4b07070d8765
[flang] Add clang-tidy check for braces around if

Flang diverges from the llvm coding style in that it requires braces
around the bodies of if/while/etc statements, even when the body is
a single statement.

This commit adds the readability-braces-around-statements check to
flang's clang-tidy config file. Hopefully the premerge bots will pick it
up and report violations in Phabricator.

We also explicitly disable the check in the directories corresponding to
the Lower and Optimizer libraries, which rely heavily on mlir and llvm
and therefore follow their coding style. Likewise for the tools
directory.

We also fix any outstanding violations in the runtime and in
lib/Semantics.

Differential Revision: https://reviews.llvm.org/D104100
13 files changed:
flang/.clang-tidy
flang/docs/C++style.md
flang/include/flang/Lower/.clang-tidy
flang/include/flang/Optimizer/.clang-tidy
flang/lib/Lower/.clang-tidy
flang/lib/Optimizer/.clang-tidy
flang/lib/Semantics/canonicalize-acc.cpp
flang/lib/Semantics/check-acc-structure.cpp
flang/lib/Semantics/check-omp-structure.cpp
flang/lib/Semantics/resolve-directives.cpp
flang/runtime/ISO_Fortran_binding.cpp
flang/tools/.clang-tidy [new file with mode: 0644]
flang/unittests/RuntimeGTest/CrashHandlerFixture.cpp