[clang] [analyzer] Recognize missing MPI collectives in MPI-Checker (PR #209263)

Martino Fontana via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 14 06:56:45 PDT 2026


================
@@ -174,6 +174,48 @@ void MPIFunctionClassifier::initCollectiveIdentifiers(ASTContext &ASTCtx) {
   MPINonBlockingTypes.push_back(IdentInfo_MPI_Ialltoall);
   MPIType.push_back(IdentInfo_MPI_Ialltoall);
   assert(IdentInfo_MPI_Ialltoall);
+
+  // Register the remaining standard collectives. These are not referenced by
+  // any of the individual is<Kind>Type() predicates, so they don't need a
+  // dedicated IdentifierInfo member; the checker only relies on them being
+  // classified as collective / nonblocking. All nonblocking (MPI_I...)
+  // variants take an MPI_Request as their last argument.
----------------
SuperSamus wrote:

The comment isn't clear that the reason why "these are not referenced by any of the individual is<Kind>Type() predicates" is simply because the checks for them aren't implemented.

Implementing this is not a priority, since the only problem in not having them is false negatives. I'm just saying that the comment should be rewritten.

(If this PR wants to implement them, note you can't for instance add `MPI_Gatherv` to `isGatherType()`, because it has different arguments. For instance, [here](https://github.com/steakhal/llvm-project/blob/a33544b83c80dcaa851fabd2979def6f68dd6e7a/clang-tools-extra/clang-tidy/mpi/TypeMismatchCheck.cpp#L287-L291) the pairs are `(0, 3)` and `(4, 6)` for `MPI_Gatherv`.)

https://github.com/llvm/llvm-project/pull/209263


More information about the cfe-commits mailing list