[PATCH] D98275: [clang-tidy] Fix mpi checks when running multiple TUs per clang-tidy process

Nathan James via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 9 11:18:42 PST 2021


njames93 created this revision.
njames93 added reviewers: alexfh, aaron.ballman.
Herald added a subscriber: xazax.hun.
njames93 requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Both the mpi-type-mismatch and mpi-buffer-deref check make use of a static MPIFunctionClassifier object.
This causes issue as the classifier is initialized with the first ASTContext that produces a match.
If the check is enabled on multiple translation units in a single clang-tidy process, this classifier won't be reinitialized for each TU. I'm not an expert in the MPIFunctionClassifier but I'd imagine this is a source of UB.
It is suspected that this bug may result in the crash caused here: https://bugs.llvm.org/show_bug.cgi?id=48985. However even if not the case, this should still be addressed.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D98275

Files:
  clang-tools-extra/clang-tidy/mpi/BufferDerefCheck.cpp
  clang-tools-extra/clang-tidy/mpi/BufferDerefCheck.h
  clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp
  clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D98275.329412.patch
Type: text/x-patch
Size: 6961 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210309/30bd9df5/attachment.bin>


More information about the cfe-commits mailing list