trixirt added a comment.
Sorry for the delay, i will have something (hopefully) this weekend.
Repository:
rC Clang
https://reviews.llvm.org/D47554
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
george.karpenkov requested changes to this revision.
george.karpenkov added a comment.
This revision now requires changes to proceed.
@NoQ had some valid comments. I think this could be still useful without
dataflow if we negate matches containing escaping and assignments.
Though of course this
NoQ added a comment.
For now the tests that i proposed may in fact accidentally work because as far
as i understand you're updating the "variable contains a value returned by
operator new" flag when you encounter assignment operators. The real problems
will arise when the order of the
NoQ added a comment.
Thanks for adding me!
Hmm, i think a matcher-based solution would be pretty limited. This is
definitely your typical all-path data-flow problem because you want to make
sure that you're looking at the //last// assignment to the variable.
For example:
int *m = new int;
alexfh added inline comments.
Comment at: lib/StaticAnalyzer/Checkers/DeadStatusChecker.cpp:33
+
+const Expr *hasNullptr(const BinaryOperator *BO) const {
+ const Expr *ret = nullptr;
george.karpenkov wrote:
> Could this be rewritten as a matcher
george.karpenkov added subscribers: aaron.ballman, alexfh.
george.karpenkov added a comment.
Herald added a subscriber: mikhail.ramalho.
Getting there! Sorry for the delay. Would it be possible to rewrite the
remaining imperative code using matchers?
on defining your own matcher. However, that
trixirt updated this revision to Diff 150003.
trixirt added a comment.
cleanup of last patch
Repository:
rC Clang
https://reviews.llvm.org/D47554
Files:
include/clang/AST/ExprCXX.h
include/clang/ASTMatchers/ASTMatchers.h
include/clang/StaticAnalyzer/Checkers/Checkers.td
trixirt updated this revision to Diff 149868.
trixirt added a comment.
Herald added a subscriber: klimek.
Convert to AST Visitor
Remove Ctx parameter from shouldNullCheckAllocation
Add a shouldNullCheckAllocation ASTMatcher
Repository:
rC Clang
https://reviews.llvm.org/D47554
Files:
george.karpenkov added a comment.
@trixirt I wrote a bunch of comments inline, but then after looking at the test
cases,
this would not work.
This is a dataflow, all-paths check (the variable can NEVER be a nullptr), yet
symbolic execution runs on A given paths.
Currently in the analyzer
trixirt created this revision.
trixirt added a reviewer: dcoughlin.
Herald added subscribers: cfe-commits, a.sidorin, szepet, xazax.hun, mgorny.
Herald added a reviewer: george.karpenkov.
The c++ 'new' function has several variants.
Only the no-throw versions of these return a nullptr on failure.
10 matches
Mail list logo