From c5bc1525343121689ee319412845e57314325795 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Fri, 4 Jul 2014 08:11:38 +0000 Subject: [PATCH] Add an explicit bool operator to SDValue to make it easier to test for a non-null node. In particular, this makes it easier to use condition variables with SDValues, etc. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@212323 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/CodeGen/SelectionDAGNodes.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/llvm/CodeGen/SelectionDAGNodes.h b/include/llvm/CodeGen/SelectionDAGNodes.h index 29c787485ee..5df40671b52 100644 --- a/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/include/llvm/CodeGen/SelectionDAGNodes.h @@ -142,6 +142,9 @@ public: bool operator<(const SDValue &O) const { return std::tie(Node, ResNo) < std::tie(O.Node, O.ResNo); } + LLVM_EXPLICIT operator bool() const { + return Node != nullptr; + } SDValue getValue(unsigned R) const { return SDValue(Node, R);