[PATCH] D76604: [Analyzer] Model `size()` member function of containers
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 23 09:15:04 PDT 2020
martong added inline comments.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp:456
+ SVal RetVal) const {
+ const auto *ContReg = Cont.getAsRegion();
+ if (!ContReg)
----------------
Just out of curiosity: How do we handle containers that do not have a contiguous memory region? Balanced trees, bucketed hash-maps, etc.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp:482-483
+ // of the container (the difference between its `begin()` and `end()` to
+ // this size. Function `relateSymbols()` returns null if it contradits
+ // the current size.
+ const auto CalcEnd =
----------------
How? I don't see how does it access the `size`.
================
Comment at: clang/lib/StaticAnalyzer/Checkers/ContainerModeling.cpp:492
+ } else {
+ if (CalcSize) {
+ // If the current size is a concrete integer, bind this to the return
----------------
What if we have both `RetSize` and `CalcSize`? Should we check their values for consistency? (And perhaps adding another sink node if we have inconsistency?)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D76604/new/
https://reviews.llvm.org/D76604
More information about the cfe-commits
mailing list