summaryrefslogtreecommitdiffstats
path: root/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
commita4e2dafd247f3cbbf5ea89457e6e2570705ff2e3 (patch)
treec40a34cd8c501968b579be278736689f6469a706 /llvm
parentffdeb1eb038ff58bff5b7914f8974509e9cb6080 (diff)
downloadbcm5719-llvm-a4e2dafd247f3cbbf5ea89457e6e2570705ff2e3.tar.gz
bcm5719-llvm-a4e2dafd247f3cbbf5ea89457e6e2570705ff2e3.zip
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. llvm-svn: 186543
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/DebugInfo.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/include/llvm/DebugInfo.h b/llvm/include/llvm/DebugInfo.h
index 372d367b707..1d7384c1170 100644
--- a/llvm/include/llvm/DebugInfo.h
+++ b/llvm/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;
}
OpenPOWER on IntegriCloud