summaryrefslogtreecommitdiffstats
path: root/llvm/unittests/ADT/PointerEmbeddedIntTest.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Re-sort #include lines for unittests. This uses a slightly modifiedChandler Carruth2017-06-061-1/+1
| | | | | | | | | | | | | | | clang-format (https://reviews.llvm.org/D33932) to keep primary headers at the top and handle new utility headers like 'gmock' consistently with other utility headers. No other change was made. I did no manual edits, all of this is clang-format. This should allow other changes to have more clear and focused diffs, and is especially motivated by moving some headers into more focused libraries. llvm-svn: 304786
* [ADT] Fix PointerEmbeddedInt when the underlying type is uintptr_t.Jordan Rose2016-02-181-0/+34
| | | | | | ...and when you try to store negative values in it. llvm-svn: 261259
* [ADT] Add an abstraction for embedding an integer within a pointer-likeChandler Carruth2016-01-101-0/+46
type. This makes it easy and safe to use a set of flags as one elmenet of a tagged union with pointers. There is quite a bit of code that has historically done this by casting arbitrary integers to "pointers" and assuming that this was safe and reliable. It is neither, and has started to rear its head by triggering safety asserts in various abstractions like PointerLikeTypeTraits when the integers chosen are invariably poor choices for *some* platform and *some* situation. Not to mention the (hopefully unlikely) prospect of one of these integers actually getting allocated! With this, it will be straightforward to build type safe abstractions like this without being error prone. The abstraction itself is also remarkably simple thanks to the implicit conversion. This use case and pattern was also independently created by the folks working on Swift, and they're going to incrementally add any missing functionality they find. Differential Revision: http://reviews.llvm.org/D15844 llvm-svn: 257284
OpenPOWER on IntegriCloud