[PATCH] D32859: [Analyzer] Iterator Checker - Part 5: Move Assignment of Containers

Artem Dergachev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 14 15:59:14 PST 2017


NoQ added inline comments.
Herald added subscribers: a.sidorin, rnkovacs, szepet.


================
Comment at: lib/StaticAnalyzer/Checkers/IteratorChecker.cpp:1489-1511
+SymbolRef replaceSymbol(SymbolManager &SymMgr, SymbolRef OrigExpr,
+                        SymbolRef OldExpr, SymbolRef NewSym) {
+  // We have a symbolic expression in the format of A+n, where we want to
+  // replace A+m with B, so the result becomes B+k, where k==n-m.
+  SymbolRef OrigSym, OldSym;
+  llvm::APSInt OrigInt, OldInt;
+  std::tie(OrigSym, OrigInt) = decompose(OrigExpr);
----------------
I do not immediately understand what is this useful for. At least tests don't look like they make use of these offset manipulations(?)

Without full understanding, i wonder: when we overwrite one container with another, why don't we just overwrite //all// symbols associated with it, instead of creating a mixture of old and new symbols?

Or maybe this is an accidental part of another patch, that has something to do with resizes?


https://reviews.llvm.org/D32859





More information about the cfe-commits mailing list