diff options
author | Enrico Granata <egranata@apple.com> | 2015-11-10 22:39:15 +0000 |
---|---|---|
committer | Enrico Granata <egranata@apple.com> | 2015-11-10 22:39:15 +0000 |
commit | 608d67c1520b9dd960f69a9137aab1ad78daae10 (patch) | |
tree | f0d99348e90f903d4824e614bd3bc7d9c8c67a2c /lldb/source/Core/ValueObject.cpp | |
parent | 467ab052916ca820eb0332ec499446640b7e0d48 (diff) | |
download | bcm5719-llvm-608d67c1520b9dd960f69a9137aab1ad78daae10.tar.gz bcm5719-llvm-608d67c1520b9dd960f69a9137aab1ad78daae10.zip |
Introduce a way for Languages to specify whether values of "reference types" are "nil" (not pointing to anything) or uninitialized (never made to point at anything)
This latter determination may or may not be possible on a per-language basis; and neither is mandatory to implement for any language
Use this knowledge in the ValueObjectPrinter to generalize the notion of IsObjCNil() and the respective printout
llvm-svn: 252663
Diffstat (limited to 'lldb/source/Core/ValueObject.cpp')
-rw-r--r-- | lldb/source/Core/ValueObject.cpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 75135554f65..fa3f1ff76db 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -2145,15 +2145,23 @@ ValueObject::IsRuntimeSupportValue () } bool -ValueObject::IsObjCNil () +ValueObject::IsNilReference () { - const uint32_t mask = eTypeIsObjC | eTypeIsPointer; - bool isObjCpointer = (((GetCompilerType().GetTypeInfo(NULL)) & mask) == mask); - if (!isObjCpointer) - return false; - bool canReadValue = true; - bool isZero = GetValueAsUnsigned(0,&canReadValue) == 0; - return canReadValue && isZero; + if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage())) + { + return language->IsNilReference(*this); + } + return false; +} + +bool +ValueObject::IsUninitializedReference () +{ + if (Language *language = Language::FindPlugin(GetObjectRuntimeLanguage())) + { + return language->IsUninitializedReference(*this); + } + return false; } // This allows you to create an array member using and index |