[Lldb-commits] [lldb] r287867 - Attempt to fix freebsd build after r287864

Pavel Labath via lldb-commits lldb-commits at lists.llvm.org
Thu Nov 24 03:22:43 PST 2016


Author: labath
Date: Thu Nov 24 05:22:43 2016
New Revision: 287867

URL: http://llvm.org/viewvc/llvm-project?rev=287867&view=rev
Log:
Attempt to fix freebsd build after r287864

the chrono library there uses long long as the underlying chrono type, but
defines int64_t as long (or the other way around, I am not sure). In any case,
this caused the implicit conversion to not trigger. This should address that.

Also fix up the relevant unit test.

Modified:
    lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
    lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.h

Modified: lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h?rev=287867&r1=287866&r2=287867&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h (original)
+++ lldb/trunk/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h Thu Nov 24 05:22:43 2016
@@ -57,9 +57,9 @@ template <typename Ratio>
 class Timeout : public llvm::Optional<std::chrono::duration<int64_t, Ratio>> {
 private:
   template <typename Ratio2> using Dur = std::chrono::duration<int64_t, Ratio2>;
-  template <typename Ratio2>
+  template <typename Rep2, typename Ratio2>
   using EnableIf = std::enable_if<
-      std::is_convertible<std::chrono::duration<int64_t, Ratio2>,
+      std::is_convertible<std::chrono::duration<Rep2, Ratio2>,
                           std::chrono::duration<int64_t, Ratio>>::value>;
 
   using Base = llvm::Optional<Dur<Ratio>>;
@@ -68,12 +68,15 @@ public:
   Timeout(llvm::NoneType none) : Base(none) {}
   Timeout(const Timeout &other) = default;
 
-  template <typename Ratio2, typename = typename EnableIf<Ratio2>::type>
+  template <typename Ratio2,
+            typename = typename EnableIf<int64_t, Ratio2>::type>
   Timeout(const Timeout<Ratio2> &other)
       : Base(other ? Base(Dur<Ratio>(*other)) : llvm::None) {}
 
-  template <typename Ratio2, typename = typename EnableIf<Ratio2>::type>
-  Timeout(const Dur<Ratio2> &other) : Base(Dur<Ratio>(other)) {}
+  template <typename Rep2, typename Ratio2,
+            typename = typename EnableIf<Rep2, Ratio2>::type>
+  Timeout(const std::chrono::duration<Rep2, Ratio2> &other)
+      : Base(Dur<Ratio>(other)) {}
 };
 
 class GDBRemoteCommunication : public Communication {

Modified: lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.h?rev=287867&r1=287866&r2=287867&view=diff
==============================================================================
--- lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.h (original)
+++ lldb/trunk/unittests/Process/gdb-remote/GDBRemoteTestUtils.h Thu Nov 24 05:22:43 2016
@@ -36,10 +36,9 @@ struct MockServer : public GDBRemoteComm
   }
 
   PacketResult GetPacket(StringExtractorGDBRemote &response) {
-    const unsigned timeout_usec = 1000000; // 1s
     const bool sync_on_timeout = false;
-    return WaitForPacketWithTimeoutMicroSecondsNoLock(response, timeout_usec,
-                                                      sync_on_timeout);
+    return WaitForPacketNoLock(response, std::chrono::seconds(1),
+                               sync_on_timeout);
   }
 
   using GDBRemoteCommunicationServer::SendOKResponse;




More information about the lldb-commits mailing list