Details
Details
Diff Detail
Diff Detail
- Repository
- rL LLVM
Event Timeline
Comment Actions
This seems like more than a performance fix - the API itself seems a little
problematic. If buildSegments was called more than once on the same
SegmentBuilder, tehre would be trouble, right? (before this patch, it could
build on top of existing segments - after this patch it will use a
moved-from-vector which might be in some non-empty state (moved from
objects are in a "valid but unspecified" state - I'm not sure there's
anything other than empty that a vector could be in, but it's still a bit
subtle/risky))
Could the API be redesigned so it doesn't have this problem?
Comment Actions
I agree with dblaikie, the API could be a bit cleaner. Wdyt of this:
- Have the SegmentBuilder constructor accept a vector<CoverageSegment>&; assert that it's empty.
- Replace Segments = SegmentBuilder().buildSegments(...) with SegmentBuilder(Segments).build(...).
Comment Actions
- Use NRVO instead of std::move.
- Prevent unexpected using of SegmentBuilder by making method buildSegments() static.