[PATCH] D104135: [analyzer] Decouple NoteTag from its Factory
Valeriy Savchenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jun 15 02:08:01 PDT 2021
vsavchenko added inline comments.
================
Comment at: clang/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h:777
static bool classof(const ProgramPointTag *T) {
return T->getTagKind() == &Kind;
}
----------------
NoQ wrote:
> vsavchenko wrote:
> > NoQ wrote:
> > > 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?
> > Yes, it's purely abstract. `ProgramPointTag` also doesn't have `classof`
> Something being purely abstract isn't a problem on its own; there are a lot of abstract classes that implement `classof()`, such as `Expr`. It's more of an artifact of the current implementation strategy.
>
> Ok np though, this doesn't seem to be a real problem.
That's true. And considering that we want different checkers to implement this on their own, we probably don't want to have one central enum listing all possible subtypes so that we can `isa` non-leaf types.
But unlike `Expr`, `DataTag` doesn't provide any information, so it's useless for people to check if something is a data tag or cast to it.
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