[PATCH] D45071: [analyzer] Track null or undef values through pointer arithmetic.

2018-03-30 Thread Phabricator via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rC328896: [analyzer] Track null or undef values through pointer arithmetic. (authored by dergachev, committed by ). Repository: rC Clang https://reviews.llvm.org/D45071 Files: lib/StaticAnalyzer/Core/

[PATCH] D45071: [analyzer] Track null or undef values through pointer arithmetic.

2018-03-30 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ marked an inline comment as done. NoQ added inline comments. Comment at: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp:78 +const Expr *peelOffPointerArithmetic(const BinaryOperator *B) { + if (B->isAdditiveOp() && B->getType()->isPointerType()) { george.

[PATCH] D45071: [analyzer] Track null or undef values through pointer arithmetic.

2018-03-30 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ updated this revision to Diff 140466. NoQ added a comment. Substraction is an additive operation. Added tests for that. Added even more tests. https://reviews.llvm.org/D45071 Files: lib/StaticAnalyzer/Core/BugReporterVisitors.cpp test/Analysis/inlining/inline-defensive-checks.c test/

[PATCH] D45071: [analyzer] Track null or undef values through pointer arithmetic.

2018-03-30 Thread George Karpenkov via Phabricator via cfe-commits
george.karpenkov accepted this revision. george.karpenkov added a comment. This revision is now accepted and ready to land. LGTM with a nit. Also I don't quite understand why being additive is important? Isn't pointer subtraction basically the same? Comment at: lib/StaticAnaly

[PATCH] D45071: [analyzer] Track null or undef values through pointer arithmetic.

2018-03-29 Thread Artem Dergachev via Phabricator via cfe-commits
NoQ created this revision. NoQ added reviewers: dcoughlin, xazax.hun, a.sidorin, george.karpenkov, szepet. Herald added subscribers: cfe-commits, rnkovacs, eraman. Pointer arithmetic on null or undefined pointers results in null or undefined pointers. This is obvious for undefined pointers; for n