Revert "Silence warnings around int/float conversions."
authorDmitri Gribenko <gribozavr@gmail.com>
Wed, 20 May 2020 09:56:16 +0000 (11:56 +0200)
committerDmitri Gribenko <gribozavr@gmail.com>
Wed, 20 May 2020 10:44:19 +0000 (12:44 +0200)
This reverts commit 15ee8a3a58223b48afbe33cb60084f864ef20889. It is a
follow-up to b783f70a42575a5d9147bea1ac97e872370fe55b, which I'm
reverting -- see the explanation in that revert.

lldb/source/Plugins/Language/ObjC/Cocoa.cpp
lldb/unittests/DataFormatter/MockTests.cpp

index 37b3522..1ad443b 100644 (file)
@@ -794,8 +794,8 @@ bool lldb_private::formatters::NSDate::FormatDateValue(double date_value,
     return true;
   }
 
-  if ((time_t)date_value > std::numeric_limits<time_t>::max() ||
-      (time_t)date_value < std::numeric_limits<time_t>::min())
+  if (date_value > std::numeric_limits<time_t>::max() ||
+      date_value < std::numeric_limits<time_t>::min())
     return false;
 
   time_t epoch = GetOSXEpoch();
index f7daaf2..1185d7b 100644 (file)
@@ -28,14 +28,14 @@ TEST(DataFormatterMockTest, NSDate) {
   EXPECT_EQ(*formatDateValue(-63114076800), "0001-12-30 00:00:00 +0000");
 
   // Can't convert the date_value to a time_t.
-  EXPECT_EQ(formatDateValue((double)(std::numeric_limits<time_t>::max()) + 1),
+  EXPECT_EQ(formatDateValue(std::numeric_limits<time_t>::max() + 1),
             llvm::None);
-  EXPECT_EQ(formatDateValue((double)(std::numeric_limits<time_t>::min()) - 1),
+  EXPECT_EQ(formatDateValue(std::numeric_limits<time_t>::min() - 1),
             llvm::None);
 
   // Can't add the macOS epoch to the converted date_value (the add overflows).
-  EXPECT_EQ(formatDateValue((double)std::numeric_limits<time_t>::max()), llvm::None);
-  EXPECT_EQ(formatDateValue((double)std::numeric_limits<time_t>::min()), llvm::None);
+  EXPECT_EQ(formatDateValue(std::numeric_limits<time_t>::max()), llvm::None);
+  EXPECT_EQ(formatDateValue(std::numeric_limits<time_t>::min()), llvm::None);
 
   // FIXME: The formatting result is wrong on Windows because we adjust the
   // epoch when _WIN32 is defined (see GetOSXEpoch).