This is an archive of the discontinued LLVM Phabricator instance.

libLLVMSupport: Generate random block of arbitrary size
ClosedPublic

Authored by evgeny777 on Aug 18 2016, 8:58 AM.

Diff Detail

Repository
rL LLVM

Event Timeline

evgeny777 updated this revision to Diff 68546.Aug 18 2016, 8:58 AM
evgeny777 retitled this revision from to libLLVMSupport: Generate random block of arbitrary size.
evgeny777 updated this object.
evgeny777 added a reviewer: lattner.
evgeny777 set the repository for this revision to rL LLVM.
evgeny777 added subscribers: llvm-commits, grimar.
lattner resigned from this revision.Aug 18 2016, 9:06 AM
lattner removed a reviewer: lattner.
davide edited edge metadata.Aug 18 2016, 9:42 AM

A couple of comments on the Unix bits. I'm not familiar with the Windows bits, one between Michael and rnk should sign-off that part before it goes in.

lib/Support/RandomNumberGenerator.cpp
79 ↗(On Diff #68546)

POSIX read() could return less bytes than you requested, or just failing, and you might want to handle that case.

80 ↗(On Diff #68546)

Also, close() can fail (so you might want to check errno in that case and propagate that back to the caller instead of swallowing it).

evgeny777 updated this revision to Diff 68707.Aug 19 2016, 10:07 AM
evgeny777 removed rL LLVM as the repository for this revision.

Added additional error checking

Any comments on this?

aaron.ballman accepted this revision.Aug 25 2016, 8:13 AM
aaron.ballman added a reviewer: aaron.ballman.
aaron.ballman added a subscriber: aaron.ballman.

Some minor nits, but LGTM

RandomNumberGenerator.cpp
68 ↗(On Diff #68707)

No need to specify the W version explicitly here. You can pass nullptr rather than 0 as well.

Unix/Unix.h
52 ↗(On Diff #68707)

Formatting of this line doesn't match the formatting of the other lines in the file.

This revision is now accepted and ready to land.Aug 25 2016, 8:13 AM
This revision was automatically updated to reflect the committed changes.