In its checkDeadSymbols callback, when no pointers are tracked and the state is not updated, MallocChecker would update the state from "the map of symbols is unset" to "the map of symbols is set to an empty map", which generates a redundant exploded node. Now that zombie symbols are fixed in D18860, we would call checkDeadSymbols() with no dead symbols more often. Avoid the unnecessary transition here.
Details
Diff Detail
Event Timeline
Please reupload with full context.
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
2369 | We are acquiring an object of type ImmutableMap, modify it, and put it back into state? Can't we just modify it through ProgramState's interface directly? |
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
2369 | state is immutable, I don't think we can put anything into it. |
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
2369 | Poor choice of words, I admit. What I actually meant is that maybe it would be more straighforward if we didnt create a local varable here. But I'm fine with being in the wrong :) |
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
2369 | Manipulating maps directly is slightly cheaper because for every operation you only create a new map but not a new state. I have no indication that this optimization is worth the effort, but i also have no indication that pessimizing it back is worth the effort. |
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
2369 | Okay, thanks :) |
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
2383–2384 | Hmmm, I guess we return here because if RegionState is unchanged, so should be ReallocPairs and FreeReturnValue, correct? |
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
2383–2384 | Yeah, kinda. Deserves a comment, i guess. |
lib/StaticAnalyzer/Checkers/MallocChecker.cpp | ||
---|---|---|
2383–2384 | Or even an assertion. |
We are acquiring an object of type ImmutableMap, modify it, and put it back into state? Can't we just modify it through ProgramState's interface directly?