diff options
author | Douglas Gregor <dgregor@apple.com> | 2009-03-30 21:44:13 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2009-03-30 21:44:13 +0000 |
commit | 2048cdb08ef6ad04bd1baf52886605d455236eb7 (patch) | |
tree | f8d36d12a6e37edd93e918d9dc30eec133752d6c /include/llvm/ADT | |
parent | 73f24c9f0d9afd1fd65d544f2b7b7b7c77fc2238 (diff) | |
download | external_llvm-2048cdb08ef6ad04bd1baf52886605d455236eb7.zip external_llvm-2048cdb08ef6ad04bd1baf52886605d455236eb7.tar.gz external_llvm-2048cdb08ef6ad04bd1baf52886605d455236eb7.tar.bz2 |
Make PointerUnion3::get work properly
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68067 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT')
-rw-r--r-- | include/llvm/ADT/PointerUnion.h | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/include/llvm/ADT/PointerUnion.h b/include/llvm/ADT/PointerUnion.h index 6f5d01a..43f5e09 100644 --- a/include/llvm/ADT/PointerUnion.h +++ b/include/llvm/ADT/PointerUnion.h @@ -193,9 +193,11 @@ namespace llvm { template<typename T> T get() const { assert(is<T>() && "Invalid accessor called"); - if (Val.is<T>()) - return Val.get<T>(); - return Val.get<InnerUnion>().get<T>(); + // Is it PT1/PT2? + if (::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0) != -1) + return Val.get<InnerUnion>().get<T>(); + + return Val.get<T>(); } /// dyn_cast<T>() - If the current value is of the specified pointer type, |