[cfe-commits] r161636 - in /cfe/trunk: lib/StaticAnalyzer/Core/MemRegion.cpp lib/StaticAnalyzer/Core/RegionStore.cpp test/Analysis/ivars.m
Ted Kremenek
kremenek at apple.com
Tue Aug 21 17:03:35 PDT 2012
On Aug 21, 2012, at 4:01 PM, Benjamin Kramer <benny.kra at gmail.com> wrote:
> On 22.08.2012, at 00:53, Ted Kremenek <kremenek at apple.com> wrote:
>
>>> - bool AddToWorkList(const MemRegion *R, RegionCluster &C) {
>>> - if (unsigned &visited = Visited[&C])
>>> - return false;
>>> - else
>>> - visited = 1;
>>> + bool AddToWorkList(const MemRegion *R, const ClusterBindings *C) {
>>> + if (C) {
>>> + if (Visited.count(C))
>>> + return false;
>>> + Visited.insert(C);
>>> + }
>>
>> If Visited was still a DenseMap this lookup-and-modify would require only one lookup, and a modify of the value in place.
>
> SmallPtrSet can do this with a single lookup, too. Insert() returns a
> boolean whether the insert was successful, i.e. the entry wasn't
> already in the set.
Perfect! Refined in r162330.
Thanks!
More information about the cfe-commits
mailing list