summaryrefslogtreecommitdiffstats
path: root/lldb/source/Host/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/source/Host/macosx')
-rw-r--r--lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp38
-rw-r--r--lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.h2
2 files changed, 40 insertions, 0 deletions
diff --git a/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp b/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp
index 963221adb4a..bce023bfd61 100644
--- a/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp
+++ b/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.cpp
@@ -432,6 +432,44 @@ CFCMutableDictionary::SetValueUInt64(CFStringRef key, uint64_t value, bool can_c
}
bool
+CFCMutableDictionary::AddValueDouble(CFStringRef key, double value, bool can_create)
+{
+ CFMutableDictionaryRef dict = Dictionary(can_create);
+ if (dict != NULL)
+ {
+ // The number may appear negative if the MSBit is set in "value". Due to a limitation of
+ // CFNumber, there isn't a way to have it show up otherwise as of this writing.
+ CFCReleaser<CFNumberRef> cf_number(::CFNumberCreate (kCFAllocatorDefault, kCFNumberDoubleType, &value));
+ if (cf_number.get())
+ {
+ // Let the dictionary own the CFNumber
+ ::CFDictionaryAddValue (dict, key, cf_number.get());
+ return true;
+ }
+ }
+ return false;
+}
+
+bool
+CFCMutableDictionary::SetValueDouble(CFStringRef key, double value, bool can_create)
+{
+ CFMutableDictionaryRef dict = Dictionary(can_create);
+ if (dict != NULL)
+ {
+ // The number may appear negative if the MSBit is set in "value". Due to a limitation of
+ // CFNumber, there isn't a way to have it show up otherwise as of this writing.
+ CFCReleaser<CFNumberRef> cf_number(::CFNumberCreate (kCFAllocatorDefault, kCFNumberDoubleType, &value));
+ if (cf_number.get())
+ {
+ // Let the dictionary own the CFNumber
+ ::CFDictionarySetValue (dict, key, cf_number.get());
+ return true;
+ }
+ }
+ return false;
+}
+
+bool
CFCMutableDictionary::AddValueCString(CFStringRef key, const char *cstr, bool can_create)
{
CFMutableDictionaryRef dict = Dictionary(can_create);
diff --git a/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.h b/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.h
index de32ead3103..a1cfb68f569 100644
--- a/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.h
+++ b/lldb/source/Host/macosx/cfcpp/CFCMutableDictionary.h
@@ -53,6 +53,8 @@ public:
bool SetValueUInt32(CFStringRef key, uint32_t value, bool can_create = false);
bool AddValueUInt64(CFStringRef key, uint64_t value, bool can_create = false);
bool SetValueUInt64(CFStringRef key, uint64_t value, bool can_create = false);
+ bool AddValueDouble(CFStringRef key, double value, bool can_create = false);
+ bool SetValueDouble(CFStringRef key, double value, bool can_create = false);
bool AddValueCString(CFStringRef key, const char *cstr, bool can_create = false);
bool SetValueCString(CFStringRef key, const char *cstr, bool can_create = false);
void RemoveValue(const void *value);
OpenPOWER on IntegriCloud