[PATCH] D97183: [analyzer] Add NoteTag for smart-ptr get()

Valeriy Savchenko via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 27 01:49:54 PDT 2021


vsavchenko added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtr.h:37
+
+class GetNoteVisitor : public BugReporterVisitor {
+private:
----------------
vsavchenko wrote:
> RedDocMD wrote:
> > vsavchenko wrote:
> > > Sorry for picking on it again, but is it visiting "get notes"? Otherwise, it is just a placeholder name that doesn't tell the reader what this class is actually for.
> > > Also, is there a reason why it is declared in the header file and couldn't be a part of `SmartPtrChecker.cpp` instead?
> > Yes it is the line `const SVal *InnerPtr = State->get<TrackedRegionMap>(ThisRegion);` in the `VisitNode` function. This uses the `TrackedRegionMap` which is defined in `SmartPtrModelling.cpp` but the visitor must be added to the bug-report in `SmartPtrChecker.cpp`.
> This comment is marked as "Done", but there is no code change nor justification.
I see. IMO it still means that the visitor belongs with the checker and was put into this header as a workaround.
So maybe instead we can add `getInnerPointer(const ProgramStateRef State, const MemRegion *ThisRegion)` since we already have a very similar `isNullSmartPtr` in this header.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D97183



More information about the cfe-commits mailing list