This is an archive of the discontinued LLVM Phabricator instance.

[clangd] Clear the semantic of RefSlab::size.
ClosedPublic

Authored by hokein on Oct 18 2018, 2:50 AM.

Details

Summary

The RefSlab::size can easily cause confusions, it returns the number of
different symbols, rahter than the number of all references.

  • add numRefs() method and cache it, since calculating it everytime is nontrivial.
  • clear misused places.

Event Timeline

hokein created this revision.Oct 18 2018, 2:50 AM

Adding numRefs() and fixing occurrences makes sense.
However I think size() needs to stay - it's an important part of the "container" concept, and e.g. GTest relies on it.

hokein updated this revision to Diff 170063.Oct 18 2018, 3:41 AM
  • reserve the size name, added a comment indicating its senmatic.

Adding numRefs() and fixing occurrences makes sense.
However I think size() needs to stay - it's an important part of the "container" concept, and e.g. GTest relies on it.

OK, and I added a comment for this method to avoid future confusion.

hokein edited the summary of this revision. (Show Details)Oct 18 2018, 3:42 AM
sammccall accepted this revision.Oct 18 2018, 4:44 AM
This revision is now accepted and ready to land.Oct 18 2018, 4:44 AM
This revision was automatically updated to reflect the committed changes.
This revision was automatically updated to reflect the committed changes.