[PATCH] D104135: [analyzer] Decouple NoteTag from its Factory

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 11 12:09:37 PDT 2021


NoQ accepted this revision.
NoQ added a comment.
This revision is now accepted and ready to land.

P.S. I like this design!

I'm trying to remember why we needed a factory in the first place. I think a lot of tags work just fine as static variables. In case of D104136 <https://reviews.llvm.org/D104136> IIUC `IdentityCall` could always be discovered as the current program point and its `Source` is its only argument so all we need is a marker that says "we did indeed model this code as identity" so it could potentially be allocated statically. But when the tag really needs to carry more data then there's probably no way around the factory.



================
Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:777
   static bool classof(const ProgramPointTag *T) {
     return T->getTagKind() == &Kind;
   }
----------------
NoQ wrote:
> It sounds like `NoteTag` `isn't<DataTag>` despite inheriting from it.
Wait nvm, `DataTag` doesn't provide a `classof` at all. This means we can't write `isa<DataTag>` at all, right?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104135



More information about the cfe-commits mailing list