[llvm] r286359 - Zero-initialize chrono duration objects

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 9 03:43:57 PST 2016


Author: labath
Date: Wed Nov  9 05:43:57 2016
New Revision: 286359

URL: http://llvm.org/viewvc/llvm-project?rev=286359&view=rev
Log:
Zero-initialize chrono duration objects

The default duration constructor does not zero-initialize the object, we need to
do that manually.

Modified:
    llvm/trunk/include/llvm/Support/CachePruning.h
    llvm/trunk/lib/Support/Unix/Process.inc

Modified: llvm/trunk/include/llvm/Support/CachePruning.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CachePruning.h?rev=286359&r1=286358&r2=286359&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CachePruning.h (original)
+++ llvm/trunk/include/llvm/Support/CachePruning.h Wed Nov  9 05:43:57 2016
@@ -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;
 };
 

Modified: llvm/trunk/lib/Support/Unix/Process.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/Unix/Process.inc?rev=286359&r1=286358&r2=286359&view=diff
==============================================================================
--- llvm/trunk/lib/Support/Unix/Process.inc (original)
+++ llvm/trunk/lib/Support/Unix/Process.inc Wed Nov  9 05:43:57 2016
@@ -66,7 +66,7 @@ static std::pair<std::chrono::microsecon
   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
 }
 




More information about the llvm-commits mailing list