[PATCH] D25660: [Analyzer] Checker for iterators dereferenced beyond their range.

Balogh, Ádám via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 7 07:43:31 PST 2016


baloghadamsoftware marked 9 inline comments as done.
baloghadamsoftware added inline comments.


================
Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:337
+  const auto *RPos = getIteratorPosition(State, Right);
+  if (LPos && !RPos) {
+    if ((LPos->isInRange() && ((Opc == BO_EQ) == Assumption)) ||
----------------
a.sidorin wrote:
> Maybe we should just swap Rhs and Lhs if LPos is null? So, we can avoid code duplication.
Instead of swapping I moved the code into a separate function and I call this functions now with differenet parameters.


================
Comment at: lib/StaticAnalyzer/Checkers/IteratorPastEndChecker.cpp:573
+
+  auto RetVal = svalBuilder.conjureSymbolVal(nullptr, CE, LCtx, C.blockCount());
+  auto SecondParam = state->getSVal(CE->getArg(1), C.getLocationContext());
----------------
a.sidorin wrote:
> You can use overload which does not require the tag.
There is an overload that does not requires a tag, but it requires a type instad.


https://reviews.llvm.org/D25660





More information about the cfe-commits mailing list