]> granicus.if.org Git - llvm/commitdiff
Add an explicit bool operator to SDValue to make it easier to test for
authorChandler Carruth <chandlerc@gmail.com>
Fri, 4 Jul 2014 08:11:38 +0000 (08:11 +0000)
committerChandler Carruth <chandlerc@gmail.com>
Fri, 4 Jul 2014 08:11:38 +0000 (08:11 +0000)
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

index 29c787485ee19b54d7d081e3469850a163dc8f75..5df40671b529f0994c81b8545df8fa542a3aeb78 100644 (file)
@@ -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);