1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-21 20:12:56 +02:00
Commit Graph

7 Commits

Author SHA1 Message Date
Jordan Rose
e196eb6e96 [ADT] Be less clever when using a nonce type for disambiguation.
Old compilers don't like constexpr, but we're only going to use this in one
place anyway: this file. Everyone else should go through PointerLikeTypeTraits.

Update to r261259.

llvm-svn: 261268
2016-02-18 22:03:23 +00:00
Jordan Rose
8c6650f01b [ADT] Fix PointerEmbeddedInt when the underlying type is uintptr_t.
...and when you try to store negative values in it.

llvm-svn: 261259
2016-02-18 21:00:08 +00:00
Jordan Rose
33941da363 [ADT] Add "return *this;" to PointerEmbeddedInt::operator=.
llvm-svn: 260407
2016-02-10 18:54:41 +00:00
Roman Divacky
aae2173227 Fix a typo.
llvm-svn: 260038
2016-02-07 15:50:55 +00:00
Benjamin Kramer
cd2490f7bc [ADT] Another stab at fixing the PointerEmbeddedInt build for MSVC.
MSVC18 seems to have other problems here, just hardcode uintptr_t.

llvm-svn: 257289
2016-01-10 14:27:26 +00:00
Benjamin Kramer
cdf764c720 [ADT] Unbreak PointerEmbeddedInt build with MSVC.
MSVC seems to have problems looking up Value inside of the template. Not
really sure whether that's a bug there or Clang and GCC being too
permissive.

llvm-svn: 257288
2016-01-10 14:06:29 +00:00
Chandler Carruth
8bbd7bacc1 [ADT] Add an abstraction for embedding an integer within a pointer-like
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
2016-01-10 09:40:13 +00:00