[PATCH] D21962: MPITypeMismatchCheck for Clang-Tidy

Alexander Droste via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 19 10:54:29 PDT 2016


Alexander_Droste marked 2 inline comments as done.
Alexander_Droste added a comment.

Thanks for looking over this once more. I'll set up an extra MPI folder and rename the check.

One comment inline.


================
Comment at: clang-tidy/misc/MpiTypeMismatchCheck.cpp:218
@@ +217,3 @@
+
+  StringRef TypedefToCompare = Typedef->getDecl()->getQualifiedNameAsString();
+  // Check if the typedef is known and not matching the MPI datatype.
----------------
alexfh wrote:
> `getQualifiedNameAsString` returns a `std::string`, which will be destroyed at the end of this statement. `TypedefToCompare` will be a dangling reference then. Please change `StringRef` to `std::string` here.
> 
> Another question is whether you need `getQualifiedNameAsString`, which is rather expensive. Maybe you could use `getName` (it returns a `StringRef` and is relatively cheap) and additionally check that the name is in the global namespace?
No, it seems I can also simply use `getName`. Why is it necessary to check if the name is in the global namespace? How would that check look like? 


https://reviews.llvm.org/D21962





More information about the cfe-commits mailing list