[PATCH] D121214: [clang-tidy][docs][NFC] Add alias cert-mem51-cpp to bugprone-shared-ptr-array-mismatch

Whisperity via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 10 02:03:18 PST 2022


whisperity added a comment.

In D121214#3369871 <https://reviews.llvm.org/D121214#3369871>, @steakhal wrote:

> Drop the alias-related changes and preserve the note in the `bugprone-shared-ptr-array-mismatch.rst` stating this relationship with the cert rule?
> If we do it like that, then this will be again NFC.

I would suggest definitely doing that. Perhaps with a bit more emphasis on this one catching the `shared_ptr` case only.
If you could create the check for the `unique_ptr` case, that would also be great.
I think some of MEM51-CPP is covered by the Static Analyser, right? (Things like `free()`ing a `new`-created pointer.)

In D121214#3369871 <https://reviews.llvm.org/D121214#3369871>, @steakhal wrote:

> How shall I proceed?

Let's ask @aaron.ballman or @njames93 with regards to that. The long-term solution would be implementing the `1-to-N` check aliasing in the infrastructure, but I understand it might be an out-of-scope work right now.

----

However, I am also in favour of creating a mapping of "partially implemented guidelines" in the documentation somewhere... maybe in the `list.rst`, maybe on a separate page. There, we could start documenting cases like this one... It's less direct than an alias, but more accessible to users who wish to cover as many rules of thumb as possible than having to iterate through hundreds of distinct documentation pages for the checks and trying to deduce //"Hey, so this one makes me catch some of that guideline!"//.

Consider (in a Markdown example, because I can never remember at the top of my head how the heading level magic characters of RST are in sequence...)

  # Guideline coverage
  
  ## CppCoreGuidelines
  
  {first the fully covered, I believe the cross-reference links here are enough}
   * X.00 Blah blah rule | cppcoreguidelines-foo-bar
   * Y.01 Blah blah rule | cppcoreguidelines-baz-qux
  
  {then the partially covered}
   * Z.99 Blah blah rule | misc-whatever-something, bugprone-fancy-diagnostics
  
  ## CERT
  <... same format ...>
  
  <... etc. ...>

Note: I'm not saying you should go ahead and create the ENTIRE collection of these data right now, just to start pinning down a format. A //"work in progress"// marker could also be added to the top of this new page.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D121214/new/

https://reviews.llvm.org/D121214



More information about the cfe-commits mailing list