diff options
| author | Chandler Carruth <chandlerc@gmail.com> | 2014-07-04 08:11:38 +0000 |
|---|---|---|
| committer | Chandler Carruth <chandlerc@gmail.com> | 2014-07-04 08:11:38 +0000 |
| commit | 872d59232611d091ad806f78ca39cb14d01868ba (patch) | |
| tree | 4415dd57f4074854493f485b75189d91b65a221e | |
| parent | 7c163a44aad58f04ff84c0307fe901640cd781e2 (diff) | |
| download | bcm5719-llvm-872d59232611d091ad806f78ca39cb14d01868ba.tar.gz bcm5719-llvm-872d59232611d091ad806f78ca39cb14d01868ba.zip | |
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.
llvm-svn: 212323
| -rw-r--r-- | llvm/include/llvm/CodeGen/SelectionDAGNodes.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h b/llvm/include/llvm/CodeGen/SelectionDAGNodes.h index 29c787485ee..5df40671b52 100644 --- a/llvm/include/llvm/CodeGen/SelectionDAGNodes.h +++ b/llvm/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); |

