alexfh added inline comments. ================ 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. ---------------- Alexander_Droste wrote: > 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? Verifying that the name is in the global namespace would make the check stricter, but there might not be a realistic case, where it would prevent a false positive. We could try without it.
https://reviews.llvm.org/D21962 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits