Zero-initialize chrono duration objects
authorPavel Labath <labath@google.com>
Wed, 9 Nov 2016 11:43:57 +0000 (11:43 +0000)
committerPavel Labath <labath@google.com>
Wed, 9 Nov 2016 11:43:57 +0000 (11:43 +0000)
The default duration constructor does not zero-initialize the object, we need to
do that manually.

llvm-svn: 286359

llvm/include/llvm/Support/CachePruning.h
llvm/lib/Support/Unix/Process.inc

index c201087..954fd8a 100644 (file)
@@ -60,8 +60,8 @@ public:
 private:
   // Options that matches the setters above.
   std::string Path;
-  std::chrono::seconds Expiration;
-  std::chrono::seconds Interval;
+  std::chrono::seconds Expiration = std::chrono::seconds::zero();
+  std::chrono::seconds Interval = std::chrono::seconds::zero();
   unsigned PercentageOfAvailableSpace = 0;
 };
 
index a5fac11..16f8f5a 100644 (file)
@@ -66,7 +66,7 @@ static std::pair<std::chrono::microseconds, std::chrono::microseconds> getRUsage
   return { toDuration(RU.ru_utime), toDuration(RU.ru_stime) };
 #else
 #warning Cannot get usage times on this platform
-  return {};
+  return { std::chrono::microseconds::zero(), std::chrono::microseconds::zero() };
 #endif
 }