[PATCH] D65681: Add support for TinyPtrVector<PointerIntPair<...> >

Andrew Trick via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 2 17:02:29 PDT 2019


atrick created this revision.
atrick added a reviewer: chandlerc.
Herald added subscribers: llvm-commits, kristina, dexonsmith, mcrosier.
Herald added a project: LLVM.

PointerIntPair and PointerUnion already mostly support nesting pointer-like types, but support was incomplete. PointerUnion::isNull still assumed that a union member was a true C++ pointer type. The meaning of PointerUnion::isNull is that the nested pointer component is null regardless of any other spare bits recursively. To adhere to the original intention of this API and fully support nested pointer types, we PointerLikeTypesTraits needs a new isNull() static method.

      

Once we have PointerLikeTypesTraits::isNull(), it's easy to make TinyPtrVector generic over pointer-like values. We just call isNull instead of assuming that pointer-like things are convertible to bool

      

Note that we don't actually want all pointer-like things to be convertible to bool because that's ambiguous for PointerIntPair.


Repository:
  rL LLVM

https://reviews.llvm.org/D65681

Files:
  llvm/include/llvm/ADT/PointerIntPair.h
  llvm/include/llvm/ADT/PointerUnion.h
  llvm/include/llvm/ADT/TinyPtrVector.h
  llvm/include/llvm/Support/PointerLikeTypeTraits.h
  llvm/unittests/ADT/TinyPtrVectorTest.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D65681.213144.patch
Type: text/x-patch
Size: 8795 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190803/ffd7752f/attachment.bin>


More information about the llvm-commits mailing list