[all-commits] [llvm/llvm-project] 02d7ef: [clang-tidy] Fix mpi checks when running multiple ...

Nathan James via All-commits all-commits at lists.llvm.org
Thu Mar 25 07:39:01 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 02d7ef3181dd6a043a8ad16d747353dd02cbb5ef
      https://github.com/llvm/llvm-project/commit/02d7ef3181dd6a043a8ad16d747353dd02cbb5ef
  Author: Nathan James <n.james93 at hotmail.co.uk>
  Date:   2021-03-25 (Thu, 25 Mar 2021)

  Changed paths:
    M clang-tools-extra/clang-tidy/mpi/BufferDerefCheck.cpp
    M clang-tools-extra/clang-tidy/mpi/BufferDerefCheck.h
    M clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp
    M clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.h

  Log Message:
  -----------
  [clang-tidy] Fix mpi checks when running multiple TUs per clang-tidy process

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.

Reviewed By: aaron.ballman

Differential Revision: https://reviews.llvm.org/D98275




More information about the All-commits mailing list