[PATCH] D70320: [Analyzer] [NFC] Iterator Checkers - Separate iterator modeling and the actual checkers

Balogh, Ádám via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 19 23:58:19 PST 2019


baloghadamsoftware marked an inline comment as done.
baloghadamsoftware added inline comments.


================
Comment at: clang/lib/StaticAnalyzer/Checkers/IteratorModeling.cpp:1308-1318
+ProgramStateRef removeIteratorPosition(ProgramStateRef State, const SVal &Val) {
   if (auto Reg = Val.getAsRegion()) {
     Reg = Reg->getMostDerivedObjectRegion();
-    return State->get<IteratorRegionMap>(Reg);
+    return State->remove<IteratorRegionMap>(Reg);
   } else if (const auto Sym = Val.getAsSymbol()) {
-    return State->get<IteratorSymbolMap>(Sym);
+    return State->remove<IteratorSymbolMap>(Sym);
   } else if (const auto LCVal = Val.getAs<nonloc::LazyCompoundVal>()) {
----------------
NoQ wrote:
> Maybe move this function to `Iterator.cpp` as well, and then move the definitions for iterator maps from `Iterator.h` to `Iterator.cpp`, which will allow you to use the usual `REGISTER_MAP_WITH_PROGRAMSTATE` macros, and additionally guarantee that all access to the maps goes through the accessor methods that you provide?
Hmm, I was trying hard to use these macros but failed so I reverted to the manual solution. I will retry now.


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D70320/new/

https://reviews.llvm.org/D70320





More information about the cfe-commits mailing list