[PATCH] D70320: [Analyzer] [NFC] Iterator Checkers - Separate iterator modeling and the actual checkers
Csaba Dabis via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 20 00:33:10 PST 2019
Charusso 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>()) {
----------------
baloghadamsoftware wrote:
> 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.
Here is a how-to: https://reviews.llvm.org/D69726
You need to add the fully qualified names to the register macro because of the global scope. I hope it helps.
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