[PATCH] D21962: MPITypeMismatchCheck for Clang-Tidy

Alexander Kornienko via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 21 17:37:54 PDT 2016


alexfh requested changes to this revision.
This revision now requires changes to proceed.

================
Comment at: clang-tidy/mpi/MPITidyModule.cpp:30
@@ +29,3 @@
+static ClangTidyModuleRegistry::Add<mpi::MPIModule> X("mpi-module",
+                                                      "Adds MPI lint checks.");
+
----------------
nit: s/lint/clang-tidy/ ;)

================
Comment at: clang-tidy/mpi/TypeMismatchCheck.cpp:11
@@ +10,3 @@
+#include "TypeMismatchCheck.h"
+#include "clang/../../lib/StaticAnalyzer/Checkers/MPI-Checker/MPIFunctionClassifier.h"
+#include "clang/Lex/Lexer.h"
----------------
Since the header is used outside of its library, it should be moved to clang/include/StaticAnalyzer/....

================
Comment at: clang-tidy/mpi/TypeMismatchCheck.cpp:50
@@ +49,3 @@
+static bool isStandardMPIDatatype(const std::string &MPIDatatype) {
+
+  static std::unordered_set<std::string> AllTypes = {
----------------
nit: Please remove the empty line.

================
Comment at: clang-tidy/mpi/TypeMismatchCheck.cpp:185
@@ +184,3 @@
+
+  if (Template->getAsCXXRecordDecl()->getNameAsString() != "complex")
+    return true;
----------------
I think, `getName` can be used here as well.

================
Comment at: clang-tidy/mpi/TypeMismatchCheck.cpp:256
@@ +255,3 @@
+
+  auto addPair = [&](const size_t BufferIdx, const size_t DatatypeIdx) {
+    // Skip null pointer constants and in place 'operators'.
----------------
Explicit captures would make the code more transparent.

================
Comment at: clang-tidy/mpi/TypeMismatchCheck.cpp:256
@@ +255,3 @@
+
+  auto addPair = [&](const size_t BufferIdx, const size_t DatatypeIdx) {
+    // Skip null pointer constants and in place 'operators'.
----------------
alexfh wrote:
> Explicit captures would make the code more transparent.
It's not clear what this lambda does. Please add a comment.

================
Comment at: clang-tidy/mpi/TypeMismatchCheck.h:52
@@ +51,3 @@
+  /// \param MPIDatatype MPI datatype name
+  void logError(const Expr *const ArgumentExpression, StringRef BufferTypeName,
+                StringRef MPIDatatype);
----------------
With just one caller and two lines of implementation this method doesn't make the code any better. Please just inline it.


https://reviews.llvm.org/D21962





More information about the cfe-commits mailing list