summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
Diffstat (limited to 'include/llvm')
-rw-r--r--include/llvm/DebugInfo.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/DebugInfo.h b/include/llvm/DebugInfo.h
index 372d367b70..1d7384c117 100644
--- a/include/llvm/DebugInfo.h
+++ b/include/llvm/DebugInfo.h
@@ -102,6 +102,13 @@ namespace llvm {
operator MDNode *() const { return const_cast<MDNode*>(DbgNode); }
MDNode *operator ->() const { return const_cast<MDNode*>(DbgNode); }
+ // An explicit operator bool so that we can do testing of DI values
+ // easily.
+ // FIXME: This operator bool isn't actually protecting anything at the
+ // moment due to the conversion operator above making DIDescriptor nodes
+ // implicitly convertable to pointer.
+ LLVM_EXPLICIT operator bool() const { return DbgNode != 0; }
+
unsigned getTag() const {
return getUnsignedField(0) & ~LLVMDebugVersionMask;
}