summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support/Unix
diff options
context:
space:
mode:
authorNAKAMURA Takumi <geek4civic@gmail.com>2012-05-06 08:24:18 +0000
committerNAKAMURA Takumi <geek4civic@gmail.com>2012-05-06 08:24:18 +0000
commit54acb28882bc42d58a0c0b8fdd8501bdb88df6e0 (patch)
treec5d7cf968f6f04a892c00e6efa6ea896b9683efb /llvm/lib/Support/Unix
parent99fdf8d418da846a7d36a46482a3d0cdec92586b (diff)
downloadbcm5719-llvm-54acb28882bc42d58a0c0b8fdd8501bdb88df6e0.tar.gz
bcm5719-llvm-54acb28882bc42d58a0c0b8fdd8501bdb88df6e0.zip
Support/Process: Move llvm::sys::Process::GetRandomNumber() from Process.cpp to Unix/Process.inc.
FIXME: GetRandomNumber() is not implemented in Win32. llvm-svn: 156251
Diffstat (limited to 'llvm/lib/Support/Unix')
-rw-r--r--llvm/lib/Support/Unix/Process.inc9
1 files changed, 9 insertions, 0 deletions
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc
index f640462a451..de982625e96 100644
--- a/llvm/lib/Support/Unix/Process.inc
+++ b/llvm/lib/Support/Unix/Process.inc
@@ -297,3 +297,12 @@ const char *Process::OutputReverse() {
const char *Process::ResetColor() {
return "\033[0m";
}
+
+unsigned llvm::sys::Process::GetRandomNumber() {
+#if defined(HAVE_ARC4RANDOM)
+ return arc4random();
+#else
+ static int x = (::srand(::time(NULL)), 0);
+ return ::rand();
+#endif
+}
OpenPOWER on IntegriCloud