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

Mehdi AMINI via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 18 12:21:01 PDT 2016

mehdi_amini added inline comments.

Comment at: include/llvm/Support/CachePruning.h:64
+  std::chrono::seconds Expiration{0};
+  std::chrono::seconds Interval{0};
   unsigned PercentageOfAvailableSpace = 0;
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. 


More information about the llvm-commits mailing list