[PATCH] D84600: [Analyzer] Support note tags for smart ptr checker
Artem Dergachev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 3 20:40:53 PDT 2020
NoQ added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/NullDereference.h:21
+namespace ento {
+namespace nullDereference {
+
----------------
Namespaces are traditionally snake_case rather than camelCase.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp:110
+ SmartPtrChecker *Checker = Mgr.registerChecker<SmartPtrChecker>();
+ NullDereferenceBugTypePtr = &Checker->NullDereferenceBugType;
}
----------------
Wait, i don't understand again. You're taking the bug type from that checker and using it in that checker. Why did you need to make it global? I thought your problem was about capturing the bug type from the //raw// null dereference checker?
================
Comment at: clang/lib/StaticAnalyzer/Checkers/SmartPtrChecker.cpp:95-96
+
+ const auto *RecordDecl = MethodDecl->getParent();
+ if (RecordDecl && RecordDecl->getDeclName().isIdentifier()) {
+ OS << " of type '" << RecordDecl->getQualifiedNameAsString() << "'";
----------------
vrnithinkumar wrote:
> NoQ wrote:
> > Aha, this time you checked for anonymous declarations! Good.
> >
> > That said, i'm not sure type is actually useful for this warning, because they're roughly all the same.
> Okay. I was trying to be consistent with `MoveChecker`.
> Just removed smart pointer type.
These were important in `MoveChecker` because use-after-move rules for smart pointers are different from use-after-move rules of any other class in the standard library and the checker has to behave differently (https://wiki.sei.cmu.edu/confluence/x/O3s-BQ).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D84600/new/
https://reviews.llvm.org/D84600
More information about the cfe-commits
mailing list