From: Chandler Carruth Date: Fri, 4 Jul 2014 08:11:38 +0000 (+0000) Subject: Add an explicit bool operator to SDValue to make it easier to test for X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=c5bc1525343121689ee319412845e57314325795;p=oota-llvm.git 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 --- 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);