[PATCH] D74340: [CodingStandards] Clarify C++ Standard Library usage

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 10 10:18:47 PST 2020


rjmccall added a comment.

In D74340#1867595 <https://reviews.llvm.org/D74340#1867595>, @rjmccall wrote:

> I think I would prefer if this were a somewhat less absolute statement, like:
>
> > When both C++ and the LLVM support libraries provide similar functionality,
> >  and there isn't a specific reason to favor the C++ implementation, it is
> >  generally preferable to use the LLVM library.  For example, `llvm::DenseMap`
> >  should almost always be used instead of `std::map` or `std::unordered_map`,
> >  and `llvm::SmallVector` should usually be used instead of `std::vector`.


Actually, do we have a discussion of the trade-offs between collection
implementations anywhere?  Some of that could go in header comments,
but it might make more sense to have a place in the documentation;
among other things, it'd be a way of pointing people towards the really
specialized implementations (like `llvm::TinyPtrVector`) that otherwise
they might have a hard time finding.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D74340





More information about the llvm-commits mailing list