[PATCH] D25730: Remove TimeValue usage from llvm/Support

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


labath added inline comments.


================
Comment at: include/llvm/Support/CachePruning.h:64
+  std::chrono::seconds Expiration{0};
+  std::chrono::seconds Interval{0};
   unsigned PercentageOfAvailableSpace = 0;
----------------
mehdi_amini wrote:
> labath wrote:
> > mehdi_amini wrote:
> > > Why not `= 0` ?
> > > (http://llvm.org/docs/CodingStandards.html#do-not-use-braced-initializer-lists-to-call-a-constructor )
> > `= 0` will not work, as duration objects are not implicitly constructible from integer types. I'd have to write `= std::chrono::seconds(0)`. After re-reading that section it's still not clear to me whether this is a permitted usage of brace-initialization. One could argue that duration is "constructed like an aggregate" (which contains only one member) and it does not do anything fancy.
> Also in the same document:
> 
> ```
> Default member initializers (non-static data member initializers): N2756
> Only use these for scalar members that would otherwise be left uninitialized. Non-scalar members generally have appropriate default constructors, and MSVC 2013 has problems when braced initializer lists are involved.
> ``
> 
> (We're removing the MSVC 2013 part right now, and still discussing the rule).
> 
> I don't know what was the intent/motivation here, so I'm not sure what's the right thing to do. 
BTW, I have learned (the hard way) that the duration default constructor does not zero-initialize the object. I've committed rL286359, to address that.


Repository:
  rL LLVM

https://reviews.llvm.org/D25730





More information about the llvm-commits mailing list