PointerUnion.h (193323) | PointerUnion.h (195340) |
---|---|
1//===- llvm/ADT/PointerUnion.h - Discriminated Union of 2 Ptrs --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 75 unchanged lines hidden (view full) --- 84 bool isNull() const { return Val.getPointer() == 0; } 85 operator bool() const { return !isNull(); } 86 87 /// is<T>() return true if the Union currently holds the type matching T. 88 template<typename T> 89 int is() const { 90 int TyNo = ::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0); 91 assert(TyNo != -1 && "Type query could never succeed on PointerUnion!"); | 1//===- llvm/ADT/PointerUnion.h - Discriminated Union of 2 Ptrs --*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// --- 75 unchanged lines hidden (view full) --- 84 bool isNull() const { return Val.getPointer() == 0; } 85 operator bool() const { return !isNull(); } 86 87 /// is<T>() return true if the Union currently holds the type matching T. 88 template<typename T> 89 int is() const { 90 int TyNo = ::llvm::getPointerUnionTypeNum<PT1, PT2>((T*)0); 91 assert(TyNo != -1 && "Type query could never succeed on PointerUnion!"); |
92 return Val.getInt() == TyNo; | 92 return static_cast<int>(Val.getInt()) == TyNo; |
93 } 94 95 /// get<T>() - Return the value of the specified pointer type. If the 96 /// specified pointer type is incorrect, assert. 97 template<typename T> 98 T get() const { 99 assert(is<T>() && "Invalid accessor called"); 100 return PointerLikeTypeTraits<T>::getFromVoidPointer(Val.getPointer()); --- 159 unchanged lines hidden --- | 93 } 94 95 /// get<T>() - Return the value of the specified pointer type. If the 96 /// specified pointer type is incorrect, assert. 97 template<typename T> 98 T get() const { 99 assert(is<T>() && "Invalid accessor called"); 100 return PointerLikeTypeTraits<T>::getFromVoidPointer(Val.getPointer()); --- 159 unchanged lines hidden --- |