Make PointerUnion3::get work properly

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@68067 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Douglas Gregor 2009-03-30 21:44:13 +00:00
parent 73f24c9f0d
commit 2048cdb08e

View File

@ -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,