diff options
author | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-04-05 20:19:49 +0000 |
---|---|---|
committer | Eugene Zelenko <eugene.zelenko@gmail.com> | 2016-04-05 20:19:49 +0000 |
commit | 1760dc2a232bde2175606ba737938d3032f1e49d (patch) | |
tree | 3859bc6b8b21c8d5073ded16260d7a5b3ff99b8f /llvm/lib/Support/Unix/Process.inc | |
parent | f2fdd013a29b26791490e3a33beda1bacfeec182 (diff) | |
download | bcm5719-llvm-1760dc2a232bde2175606ba737938d3032f1e49d.tar.gz bcm5719-llvm-1760dc2a232bde2175606ba737938d3032f1e49d.zip |
Fix Clang-tidy modernize-deprecated-headers warnings in remaining files; other minor fixes.
Some Include What You Use suggestions were used too.
Use anonymous namespaces in source files.
Differential revision: http://reviews.llvm.org/D18778
llvm-svn: 265454
Diffstat (limited to 'llvm/lib/Support/Unix/Process.inc')
-rw-r--r-- | llvm/lib/Support/Unix/Process.inc | 36 |
1 files changed, 27 insertions, 9 deletions
diff --git a/llvm/lib/Support/Unix/Process.inc b/llvm/lib/Support/Unix/Process.inc index cad81f8074f..350b145c28c 100644 --- a/llvm/lib/Support/Unix/Process.inc +++ b/llvm/lib/Support/Unix/Process.inc @@ -30,9 +30,7 @@ #ifdef HAVE_SYS_STAT_H #include <sys/stat.h> #endif -#if HAVE_SIGNAL_H -#include <signal.h> -#endif +#include <csignal> // DragonFlyBSD, OpenBSD, and Bitrig have deprecated <malloc.h> for // <stdlib.h> instead. Unix.h includes this for us already. #if defined(HAVE_MALLOC_H) && !defined(__DragonFly__) && \ @@ -60,7 +58,9 @@ using namespace llvm; using namespace sys; -static std::pair<TimeValue, TimeValue> getRUsageTimes() { +namespace { + +std::pair<TimeValue, TimeValue> getRUsageTimes() { #if defined(HAVE_GETRUSAGE) struct rusage RU; ::getrusage(RUSAGE_SELF, &RU); @@ -79,6 +79,8 @@ static std::pair<TimeValue, TimeValue> getRUsageTimes() { #endif } +} // end anonymous namespace + // On Cygwin, getpagesize() returns 64k(AllocationGranularity) and // offset in mmap(3) should be aligned to the AllocationGranularity. unsigned Process::getPageSize() { @@ -189,6 +191,7 @@ Process::GetArgumentVector(SmallVectorImpl<const char *> &ArgsOut, } namespace { + class FDCloser { public: FDCloser(int &FD) : FD(FD), KeepOpen(false) {} @@ -205,7 +208,8 @@ private: int &FD; bool KeepOpen; }; -} + +} // end anonymous namespace std::error_code Process::FixupStandardFileDescriptors() { int NullFD = -1; @@ -300,7 +304,9 @@ bool Process::FileDescriptorIsDisplayed(int fd) { #endif } -static unsigned getColumns(int FileID) { +namespace { + +unsigned getColumns(int FileID) { // If COLUMNS is defined in the environment, wrap to that many columns. if (const char *ColumnsStr = std::getenv("COLUMNS")) { int Columns = std::atoi(ColumnsStr); @@ -320,6 +326,8 @@ static unsigned getColumns(int FileID) { return Columns; } +} // end anonymous namespace + unsigned Process::StandardOutColumns() { if (!StandardOutIsDisplayed()) return 0; @@ -344,11 +352,13 @@ extern "C" int del_curterm(struct term *termp); extern "C" int tigetnum(char *capname); #endif +namespace { + #ifdef HAVE_TERMINFO -static ManagedStatic<sys::Mutex> TermColorMutex; +ManagedStatic<sys::Mutex> TermColorMutex; #endif -static bool terminalHasColors(int fd) { +bool terminalHasColors(int fd) { #ifdef HAVE_TERMINFO // First, acquire a global lock because these C routines are thread hostile. MutexGuard G(*TermColorMutex); @@ -388,6 +398,8 @@ static bool terminalHasColors(int fd) { return false; } +} // end anonymous namespace + bool Process::FileDescriptorHasColors(int fd) { // A file descriptor has colors if it is displayed and the terminal has // colors. @@ -428,7 +440,10 @@ const char *Process::ResetColor() { } #if !defined(HAVE_DECL_ARC4RANDOM) || !HAVE_DECL_ARC4RANDOM -static unsigned GetRandomNumberSeed() { + +namespace { + +unsigned GetRandomNumberSeed() { // Attempt to get the initial seed from /dev/urandom, if possible. int urandomFD = open("/dev/urandom", O_RDONLY); @@ -450,6 +465,9 @@ static unsigned GetRandomNumberSeed() { TimeValue Now = TimeValue::now(); return hash_combine(Now.seconds(), Now.nanoseconds(), ::getpid()); } + +} // end anonymous namespace + #endif unsigned llvm::sys::Process::GetRandomNumber() { |