df6e5fb77ca864c55735b903eb022fb1e38fa3d2 |
|
15-May-2013 |
Douglas Gregor <dgregor@apple.com> |
Add missing #include git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181900 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
453f4f01302f00651aae2fc7658f6e23a2beadb0 |
|
15-May-2013 |
David Blaikie <dblaikie@gmail.com> |
Use only explicit bool conversion operators BitVector/SmallBitVector::reference::operator bool remain implicit since they model more exactly a bool, rather than something else that can be boolean tested. The most common (non-buggy) case are where such objects are used as return expressions in bool-returning functions or as boolean function arguments. In those cases I've used (& added if necessary) a named function to provide the equivalent (or sometimes negative, depending on convenient wording) test. One behavior change (YAMLParser) was made, though no test case is included as I'm not sure how to reach that code path. Essentially any comparison of llvm::yaml::document_iterators would be invalid if neither iterator was at the end. This helped uncover a couple of bugs in Clang - test cases provided for those in a separate commit along with similar changes to `operator bool` instances in Clang. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@181868 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
acb8d9fbe3853394a2537985349993580309b8cd |
|
03-Dec-2012 |
Argyrios Kyrtzidis <akyrtzi@gmail.com> |
Eliminate redundant bitwise operations when using a llvm/ADT/PointerUnion. For comparison, with this code sample: PointerUnion<int *, char *> Data; PointerUnion<int *, char *> foo1() { Data = new int; return new int; } PointerUnion<int *, char *> foo2() { Data = new char; return new char; } Before this patch we would get: define i64 @_Z4foo1v() uwtable ssp { %1 = tail call noalias i8* @_Znwm(i64 4) %2 = ptrtoint i8* %1 to i64 %3 = load i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8 %4 = and i64 %3, 1 %.masked.i = and i64 %2, -3 %5 = or i64 %4, %.masked.i store i64 %5, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8 %6 = tail call noalias i8* @_Znwm(i64 4) %7 = ptrtoint i8* %6 to i64 %8 = and i64 %7, -3 ret i64 %8 } define i64 @_Z4foo2v() uwtable ssp { %1 = tail call noalias i8* @_Znwm(i64 1) %2 = ptrtoint i8* %1 to i64 %3 = load i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8 %4 = and i64 %3, 1 %5 = or i64 %2, %4 %6 = or i64 %5, 2 store i64 %6, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8 %7 = tail call noalias i8* @_Znwm(i64 1) %8 = ptrtoint i8* %7 to i64 %9 = or i64 %8, 2 ret i64 %9 } After the patch: define i64 @_Z4foo1v() uwtable ssp { %1 = tail call noalias i8* @_Znwm(i64 4) %2 = ptrtoint i8* %1 to i64 store i64 %2, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8 %3 = tail call noalias i8* @_Znwm(i64 4) %4 = ptrtoint i8* %3 to i64 ret i64 %4 } declare noalias i8* @_Znwm(i64) define i64 @_Z4foo2v() uwtable ssp { %1 = tail call noalias i8* @_Znwm(i64 1) %2 = ptrtoint i8* %1 to i64 %3 = or i64 %2, 2 store i64 %3, i64* getelementptr inbounds (%"class.llvm::PointerUnion"* @Data, i64 0, i32 0, i32 0), align 8 %4 = tail call noalias i8* @_Znwm(i64 1) %5 = ptrtoint i8* %4 to i64 %6 = or i64 %5, 2 ret i64 %6 } git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169147 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
b76fb96cd66aec709e2a0cfda8c29c53ba5ad98c |
|
13-Jul-2012 |
Galina Kistanova <gkistanova@gmail.com> |
Fixed few warnings. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@160192 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
87d8e60505b26960956996550c8b805c81e5b02b |
|
11-Mar-2012 |
Douglas Gregor <dgregor@apple.com> |
Add a few missing 'template' keywords git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152525 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
0db235a2b0ed6ae5c3c870012061906054b6dbc4 |
|
06-Mar-2012 |
Argyrios Kyrtzidis <akyrtzi@gmail.com> |
PointerUnion::getAddrOf() does not need to be template since we can only use the first pointer type for it. Rename it to getAddrOfPtr1(). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@152106 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
823eb1ca11d684530048f1fe85a727aa1ef622d1 |
|
12-Aug-2011 |
Chris Lattner <sabre@nondot.org> |
Fix an obscure bug in PointerUnion that would bite PointerUnion3/4. Basically, when checking isNull(), we'd pick off the sentinel bit for the outer PointerUnion, but would not recursively convert the inner pointerunion to bool, so if *its* sentinel bit is set, isNull() would incorrectly return false. No testcase, because someone hit this when they were trying to refactor code to use PointerUnion3, but they since found a better solution. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137428 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
a36be826643ed1f6a4639f79270276df621853ba |
|
07-Mar-2011 |
Argyrios Kyrtzidis <akyrtzi@gmail.com> |
Try fixing mingw build. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127153 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
128ccbb8e5e142d4ec6c9afb4160b74f76cb3064 |
|
07-Mar-2011 |
Argyrios Kyrtzidis <akyrtzi@gmail.com> |
Do a compiler check that we use one of the types from PointerUnion[N], instead of a runtime check. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127145 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
38297f5f760de604258aaa9000e5aadb43c78921 |
|
19-Feb-2011 |
Argyrios Kyrtzidis <akyrtzi@gmail.com> |
Allow getting the address of the value in a PointerUnion or PointerIntPair if one is confident enough that he knows what he is doing. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126019 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
8260ea5c6c15345e00ced1398b03e6886145e45c |
|
30-Mar-2010 |
Ted Kremenek <kremenek@apple.com> |
Change PointerUnionX::getFromOpaqueValue() to be declared 'static inline' instead of 'static'. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@99892 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
6a66b388469f045c9fcff839595900c9f1512177 |
|
06-Nov-2009 |
Douglas Gregor <dgregor@apple.com> |
Add a bunch of missing "template" keywords to disambiguate dependent template names. GCC eats this ill-formed code, Clang does not. I already filed PR5404 to improve recovery in this case git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86204 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
26ef510d5d20b89c637d13e2d9169c0458de775c |
|
29-Jul-2009 |
Douglas Gregor <dgregor@apple.com> |
Fix a typo, and all of its copies git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77489 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
e657ec6701ee78e70ed7de43a9d98dbd00f330e5 |
|
29-Jul-2009 |
Douglas Gregor <dgregor@apple.com> |
Implement PointerUnion4. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@77487 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
37c286c18128cce7f52654876a5a104150be4b79 |
|
29-Jun-2009 |
Sebastian Redl <sebastian.redl@getdesigned.at> |
Fix three MSVC 2008 warnings that completely clutter the build output. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@74430 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
41222823db11107834414a378525bb21493d3a1f |
|
01-Apr-2009 |
Douglas Gregor <dgregor@apple.com> |
Allow the use of pointers to const within PointerUnion. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68159 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
da84b25b13f05b94c6c9478b1bc552054756759e |
|
31-Mar-2009 |
Douglas Gregor <dgregor@apple.com> |
Stop guessing, start thinking, and make PointerUnion3::is actually be correct. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68126 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
a7425d7fde61c2207a4467464df90b5e3e58a769 |
|
31-Mar-2009 |
Douglas Gregor <dgregor@apple.com> |
Really, really fix PointerUnion3::is git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68079 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
2048cdb08ef6ad04bd1baf52886605d455236eb7 |
|
30-Mar-2009 |
Douglas Gregor <dgregor@apple.com> |
Make PointerUnion3::get work properly git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68067 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
f54229192c22559389b0ef47e731fd628db963c5 |
|
30-Mar-2009 |
Chris Lattner <sabre@nondot.org> |
update comment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68060 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
e8bc475668ddd2f31f44dd00b042d15b255e1b9e |
|
30-Mar-2009 |
Chris Lattner <sabre@nondot.org> |
add a PointerUnion3 class and generalize PointerUnion to work with anything pointer-like, which may or may not actually be a pointer. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68056 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
3a9fe06bfe30da6fb1e0a540f05877c3640c7335 |
|
29-Mar-2009 |
Chris Lattner <sabre@nondot.org> |
add some comments, add a dyn_cast method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67992 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
ba315c1ee7bef78c6824441fe6c1761596ec9880 |
|
29-Mar-2009 |
Chris Lattner <sabre@nondot.org> |
add helper method. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67989 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|
2491e4657d95f7ff61fb2a741ba9996e492df515 |
|
29-Mar-2009 |
Chris Lattner <sabre@nondot.org> |
Add a simple type-safe bit-mangling pointer union class. This allows you to do things like: /// PointerUnion<int*, float*> P; /// P = (int*)0; /// printf("%d %d", P.is<int*>(), P.is<float*>()); // prints "1 0" /// X = P.get<int*>(); // ok. /// Y = P.get<float*>(); // runtime assertion failure. /// Z = P.get<double*>(); // does not compile. /// P = (float*)0; /// Y = P.get<float*>(); // ok. /// X = P.get<int*>(); // runtime assertion failure. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67987 91177308-0d34-0410-b5e6-96231b3b80d8
/external/llvm/include/llvm/ADT/PointerUnion.h
|