summaryrefslogtreecommitdiff
path: root/include/llvm
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2013-07-17 22:53:05 +0000
committerEric Christopher <echristo@gmail.com>2013-07-17 22:53:05 +0000
commitb479870e89da4d2810ebc9dccf704f666e2b7248 (patch)
tree49a13d529c32f42220c5a54e4077267cb3cf2255 /include/llvm
parent3a7997516982117382b9023ea1176fd53caa948d (diff)
downloadllvm-b479870e89da4d2810ebc9dccf704f666e2b7248.tar.gz
llvm-b479870e89da4d2810ebc9dccf704f666e2b7248.tar.bz2
llvm-b479870e89da4d2810ebc9dccf704f666e2b7248.tar.xz
Add an explicit operator bool conversion to DIDescriptor to make
it clear what we want to do. Unfortunately the conversion to pointer operator fires now instead and chasing down all of the conversions and making them explicit and handled is a large task so add a FIXME with it. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@186543 91177308-0d34-0410-b5e6-96231b3b80d8
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;
}