[llvm-commits] [llvm] r68067 - /llvm/trunk/include/llvm/ADT/PointerUnion.h

Douglas Gregor dgregor at apple.com
Mon Mar 30 14:44:13 PDT 2009


Author: dgregor
Date: Mon Mar 30 16:44:13 2009
New Revision: 68067

URL: http://llvm.org/viewvc/llvm-project?rev=68067&view=rev
Log:
Make PointerUnion3::get work properly

Modified:
    llvm/trunk/include/llvm/ADT/PointerUnion.h

Modified: llvm/trunk/include/llvm/ADT/PointerUnion.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerUnion.h?rev=68067&r1=68066&r2=68067&view=diff

==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerUnion.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerUnion.h Mon Mar 30 16:44:13 2009
@@ -193,9 +193,11 @@
     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,





More information about the llvm-commits mailing list