[Lldb-commits] [lldb] f3b5bf3 - [lldb] Fix NSDate test after Scalar change

Raphael Isemann via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 1 07:02:47 PDT 2020


Author: Raphael Isemann
Date: 2020-07-01T16:00:10+02:00
New Revision: f3b5bf3eb7029238cead637be2e285b443b2e141

URL: https://github.com/llvm/llvm-project/commit/f3b5bf3eb7029238cead637be2e285b443b2e141
DIFF: https://github.com/llvm/llvm-project/commit/f3b5bf3eb7029238cead637be2e285b443b2e141.diff

LOG: [lldb] Fix NSDate test after Scalar change

The formatter was requesting an unsigned integer from the ValueObject,
but CFAbsoluteTime is a signed double, so in the NSDate test the formatter
actually just printed the 'error value' date which is the Cocoa epoch. This
started failing after the recent Scalar changes.

This patch just changes the logic to use a signed value which fits to the data
we try to read and avoids this issue.

Added: 
    

Modified: 
    lldb/source/Plugins/Language/ObjC/CF.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Language/ObjC/CF.cpp b/lldb/source/Plugins/Language/ObjC/CF.cpp
index 9e4eb9d53d47..2610468b17fd 100644
--- a/lldb/source/Plugins/Language/ObjC/CF.cpp
+++ b/lldb/source/Plugins/Language/ObjC/CF.cpp
@@ -29,7 +29,7 @@ using namespace lldb_private::formatters;
 bool lldb_private::formatters::CFAbsoluteTimeSummaryProvider(
     ValueObject &valobj, Stream &stream, const TypeSummaryOptions &options) {
   time_t epoch = GetOSXEpoch();
-  epoch = epoch + (time_t)valobj.GetValueAsUnsigned(0);
+  epoch = epoch + (time_t)valobj.GetValueAsSigned(0);
   tm *tm_date = localtime(&epoch);
   if (!tm_date)
     return false;


        


More information about the lldb-commits mailing list