summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2009-03-30 21:44:13 +0000
committerDouglas Gregor <dgregor@apple.com>2009-03-30 21:44:13 +0000
commitd33a33cedb6021c261fe29e77676306c3f41ce41 (patch)
tree3cfe94a2d64fa39ba92b749c2f2237bd6b15d992
parenta84a318873c8769aba2681f4224e0ce0e7bdcb70 (diff)
downloadbcm5719-llvm-d33a33cedb6021c261fe29e77676306c3f41ce41.tar.gz
bcm5719-llvm-d33a33cedb6021c261fe29e77676306c3f41ce41.zip
Make PointerUnion3::get work properly
llvm-svn: 68067
-rw-r--r--llvm/include/llvm/ADT/PointerUnion.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/include/llvm/ADT/PointerUnion.h b/llvm/include/llvm/ADT/PointerUnion.h
index 6f5d01af86a..43f5e09cf9e 100644
--- a/llvm/include/llvm/ADT/PointerUnion.h
+++ b/llvm/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,
OpenPOWER on IntegriCloud