[PATCH] D143976: [ADT] Add lookupOrTrap method to DenseMap and StringMap

Xiangxi Guo (Ryan) via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 14 12:12:28 PST 2023


StrongerXi added a comment.

I agree that `at` has the advantage of being similar (in spelling & semantics) to `std::map::at`. Possible counterarguments:

1. `at` too implicit about the "assertive/validated" semantics.
2. having something similar to `lookup` is a easier to adapt for existing users, also makes the API more consistent/intuitive.

I can't seem to think of many alternatives though, `lookupChecked`? What do you all think?

I also agree that renaming the old `lookup` should be a separate issue, and I think it has backward compatibility concerns too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143976/new/

https://reviews.llvm.org/D143976



More information about the llvm-commits mailing list