[PATCH] D57113: [clang-tidy] openmp-use-default-none - a new module and a check

Roman Lebedev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 23 11:57:32 PST 2019


lebedev.ri created this revision.
lebedev.ri added reviewers: JonasToth, aaron.ballman, alexfh, xazax.hun, hokein.
lebedev.ri added projects: clang-tools-extra, OpenMP.
Herald added subscribers: guansong, rnkovacs, mgorny.

Finds OpenMP directives that are allowed to contain `default` clause,
but either don't specify it, or the clause is specified but with the kind
other than `none`, and suggests to use `default(none)` clause.

Using `default(none)` clause changes the default variable visibility from
being implicitly determined, and thus forces developer to be explicit about the
desired data scoping for each variable.

--------------------------------------------------------------------------------

Since this seems to be ground-breaking (as in the first one) OpenMP check
in (upstream?) clang-tidy, there is a lot of boilerplate matchers.
I suppose eventually (some of them?) will migrate to be proper AST matchers.

I'm not happy with how `isAllowedToContainClause()` actually takes the
`enum OpenMPClauseKind` value, instead of something nicer, be it either
the actual AST class name (`OMPDefaultClause`), or the matcher (`ompDefaultClause`)
that would normally match that node.

Same goes for `ompDefaultClause(hasKind())`, which takes the
`enum OpenMPDefaultClauseKind` value.

Depends on D57112 <https://reviews.llvm.org/D57112>.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D57113

Files:
  clang-tidy/CMakeLists.txt
  clang-tidy/ClangTidyForceLinker.h
  clang-tidy/openmp/CMakeLists.txt
  clang-tidy/openmp/OpenMPTidyModule.cpp
  clang-tidy/openmp/UseDefaultNoneCheck.cpp
  clang-tidy/openmp/UseDefaultNoneCheck.h
  clang-tidy/plugin/CMakeLists.txt
  clang-tidy/tool/CMakeLists.txt
  docs/ReleaseNotes.rst
  docs/clang-tidy/checks/list.rst
  docs/clang-tidy/checks/openmp-use-default-none.rst
  test/clang-tidy/openmp-use-default-none.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57113.183145.patch
Type: text/x-patch
Size: 18214 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190123/e7bb4284/attachment-0001.bin>


More information about the cfe-commits mailing list