Page MenuHomePhabricator

Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline

[CodeGenDAGPatterns] Replaces some implicit map inserts with count.

Authored by staronj on Feb 16 2017, 4:58 AM.



Working on clang-tidy check that is finding modifications of container you are iterating I found this lines of code. Here, we are using operator[] on std::map and as I understand, depending on the behaviour of operator[] - creating new entry in absence of key (ie. as I understand, comparisons in line 3223 and 3231 should succeed only if Entry.first was not in map).

Changing it to explicitly checking presence in map is cleaner and less bug-prone.

Diff Detail

Event Timeline

staronj created this revision.Feb 16 2017, 4:58 AM
staronj retitled this revision from [LLVM] Replaces some implicit map inserts with count. to [CodeGenDAGPatterns] Replaces some implicit map inserts with count..Feb 16 2017, 5:01 AM
staronj edited the summary of this revision. (Show Details)Feb 17 2017, 6:41 AM
Prazek edited edge metadata.

LGTM, but I would wait for someone else to accept it.

staronj abandoned this revision.Apr 23 2017, 2:05 AM