diff options
author | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-05-06 08:24:18 +0000 |
---|---|---|
committer | NAKAMURA Takumi <geek4civic@gmail.com> | 2012-05-06 08:24:18 +0000 |
commit | 24cddd5c9a7622e06e7ae0e0887e5e0d48326606 (patch) | |
tree | ad95b55a65631b7018c5dd62c021ff7ee0ed5e6d /lib/Support | |
parent | 77eafd940a2fcbecbd82e1a649b7f081cb4a3d4a (diff) | |
download | external_llvm-24cddd5c9a7622e06e7ae0e0887e5e0d48326606.zip external_llvm-24cddd5c9a7622e06e7ae0e0887e5e0d48326606.tar.gz external_llvm-24cddd5c9a7622e06e7ae0e0887e5e0d48326606.tar.bz2 |
Support/Process: Move llvm::sys::Process::GetRandomNumber() from Process.cpp to Unix/Process.inc.
FIXME: GetRandomNumber() is not implemented in Win32.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@156251 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/Process.cpp | 10 | ||||
-rw-r--r-- | lib/Support/Unix/Process.inc | 9 |
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/Support/Process.cpp b/lib/Support/Process.cpp index 2cff1ce..88ca7c3 100644 --- a/lib/Support/Process.cpp +++ b/lib/Support/Process.cpp @@ -13,7 +13,6 @@ #include "llvm/Support/Process.h" #include "llvm/Config/config.h" -#include <cstdlib> namespace llvm { using namespace sys; @@ -23,15 +22,6 @@ using namespace sys; //=== independent code. //===----------------------------------------------------------------------===// -unsigned llvm::sys::Process::GetRandomNumber() { -#if defined(HAVE_ARC4RANDOM) - return arc4random(); -#else - static int x = (::srand(::time(NULL)), 0); - return ::rand(); -#endif -} - } // Include the platform-specific parts of this class. diff --git a/lib/Support/Unix/Process.inc b/lib/Support/Unix/Process.inc index f640462..de98262 100644 --- a/lib/Support/Unix/Process.inc +++ b/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 +} |