[PATCH] D36354: [clang-tidy] Implement type-based check for `gsl::owner`

Jonas Toth via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 11 08:14:52 PDT 2017


JonasToth marked an inline comment as done.
JonasToth added inline comments.


================
Comment at: clang-tidy/cppcoreguidelines/OwningMemoryCheck.cpp:188
+    diag(OwnerAssignment->getLocStart(),
+         "assigning neither an owner nor a recognized resource")
+        << SourceRange(OwnerAssignment->getLocStart(),
----------------
aaron.ballman wrote:
> Same comments here as above about "owner" and "recognized resource". I think you want to talk about `gsl::owner<>` where you use "owner" and drop "recognized resource" (because such a resource returns a `gsl::owner<>`-flagged type, if I understand properly).
ideally every created resource would be flagged as `gsl::owner<>`, but for example `fopen`, `malloc` and friends can't, but would benefit the most from such a check (+ flow analysis if the owner gets consumed on every path)


https://reviews.llvm.org/D36354





More information about the cfe-commits mailing list