aboutsummaryrefslogtreecommitdiffstats
path: root/include/llvm/System
diff options
context:
space:
mode:
authorJush Lu <jush.msn@gmail.com>2011-03-09 19:39:16 +0800
committerJush Lu <jush.msn@gmail.com>2011-03-09 19:39:16 +0800
commitb5530586d68bd25831a6796b5d3199cb0769a35c (patch)
treefac4a03b53b6a64b0c00f433e4d8b3c9f2bc67cd /include/llvm/System
parentb4e17c5bf4361bbdeced39aa071150d7fa9c3c10 (diff)
parentd01f50f42ce60207ed6d27fb1778e456d83be06c (diff)
downloadexternal_llvm-b5530586d68bd25831a6796b5d3199cb0769a35c.zip
external_llvm-b5530586d68bd25831a6796b5d3199cb0769a35c.tar.gz
external_llvm-b5530586d68bd25831a6796b5d3199cb0769a35c.tar.bz2
Merge upstream r127116
Diffstat (limited to 'include/llvm/System')
-rw-r--r--include/llvm/System/AIXDataTypesFix.h25
-rw-r--r--include/llvm/System/Alarm.h51
-rw-r--r--include/llvm/System/Atomic.h39
-rw-r--r--include/llvm/System/DataTypes.h.cmake189
-rw-r--r--include/llvm/System/DataTypes.h.in111
-rw-r--r--include/llvm/System/Disassembler.h35
-rw-r--r--include/llvm/System/DynamicLibrary.h86
-rw-r--r--include/llvm/System/Errno.h34
-rw-r--r--include/llvm/System/FEnv.h56
-rw-r--r--include/llvm/System/Host.h66
-rw-r--r--include/llvm/System/IncludeFile.h79
-rw-r--r--include/llvm/System/LICENSE.TXT6
-rw-r--r--include/llvm/System/Memory.h96
-rw-r--r--include/llvm/System/Mutex.h154
-rw-r--r--include/llvm/System/Path.h738
-rw-r--r--include/llvm/System/Process.h146
-rw-r--r--include/llvm/System/Program.h157
-rw-r--r--include/llvm/System/RWMutex.h173
-rw-r--r--include/llvm/System/Signals.h59
-rw-r--r--include/llvm/System/Solaris.h40
-rw-r--r--include/llvm/System/SwapByteOrder.h101
-rw-r--r--include/llvm/System/ThreadLocal.h54
-rw-r--r--include/llvm/System/Threading.h59
-rw-r--r--include/llvm/System/TimeValue.h382
-rw-r--r--include/llvm/System/Valgrind.h32
25 files changed, 0 insertions, 2968 deletions
diff --git a/include/llvm/System/AIXDataTypesFix.h b/include/llvm/System/AIXDataTypesFix.h
deleted file mode 100644
index 8dbf02f..0000000
--- a/include/llvm/System/AIXDataTypesFix.h
+++ /dev/null
@@ -1,25 +0,0 @@
-//===-- llvm/System/AIXDataTypesFix.h - Fix datatype defs ------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file overrides default system-defined types and limits which cannot be
-// done in DataTypes.h.in because it is processed by autoheader first, which
-// comments out any #undef statement
-//
-//===----------------------------------------------------------------------===//
-
-// No include guards desired!
-
-#ifndef SUPPORT_DATATYPES_H
-#error "AIXDataTypesFix.h must only be included via DataTypes.h!"
-#endif
-
-// GCC is strict about defining large constants: they must have LL modifier.
-// These will be defined properly at the end of DataTypes.h
-#undef INT64_MAX
-#undef INT64_MIN
diff --git a/include/llvm/System/Alarm.h b/include/llvm/System/Alarm.h
deleted file mode 100644
index 7c28416..0000000
--- a/include/llvm/System/Alarm.h
+++ /dev/null
@@ -1,51 +0,0 @@
-//===- llvm/System/Alarm.h - Alarm Generation support ----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides an operating system independent interface to alarm(2)
-// type functionality. The Alarm class allows a one-shot alarm to be set up
-// at some number of seconds in the future. When the alarm triggers, a method
-// is called to process the event
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_ALARM_H
-#define LLVM_SYSTEM_ALARM_H
-
-namespace llvm {
-namespace sys {
-
- /// This function registers an alarm to trigger some number of \p seconds in
- /// the future. When that time arrives, the AlarmStatus function will begin
- /// to return 1 instead of 0. The user must poll the status of the alarm by
- /// making occasional calls to AlarmStatus. If the user sends an interrupt
- /// signal, AlarmStatus will begin returning -1, even if the alarm event
- /// occurred.
- /// @returns nothing
- void SetupAlarm(
- unsigned seconds ///< Number of seconds in future when alarm arrives
- );
-
- /// This function terminates the alarm previously set up
- /// @returns nothing
- void TerminateAlarm();
-
- /// This function acquires the status of the alarm.
- /// @returns -1=cancelled, 0=untriggered, 1=triggered
- int AlarmStatus();
-
- /// Sleep for n seconds. Warning: mixing calls to Sleep() and other *Alarm
- /// calls may be a bad idea on some platforms (source: Linux man page).
- /// @returns nothing.
- void Sleep(unsigned n);
-
-
-} // End sys namespace
-} // End llvm namespace
-
-#endif
diff --git a/include/llvm/System/Atomic.h b/include/llvm/System/Atomic.h
deleted file mode 100644
index fc19369..0000000
--- a/include/llvm/System/Atomic.h
+++ /dev/null
@@ -1,39 +0,0 @@
-//===- llvm/System/Atomic.h - Atomic Operations -----------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the llvm::sys atomic operations.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_ATOMIC_H
-#define LLVM_SYSTEM_ATOMIC_H
-
-#include "llvm/System/DataTypes.h"
-
-namespace llvm {
- namespace sys {
- void MemoryFence();
-
-#ifdef _MSC_VER
- typedef long cas_flag;
-#else
- typedef uint32_t cas_flag;
-#endif
- cas_flag CompareAndSwap(volatile cas_flag* ptr,
- cas_flag new_value,
- cas_flag old_value);
- cas_flag AtomicIncrement(volatile cas_flag* ptr);
- cas_flag AtomicDecrement(volatile cas_flag* ptr);
- cas_flag AtomicAdd(volatile cas_flag* ptr, cas_flag val);
- cas_flag AtomicMul(volatile cas_flag* ptr, cas_flag val);
- cas_flag AtomicDiv(volatile cas_flag* ptr, cas_flag val);
- }
-}
-
-#endif
diff --git a/include/llvm/System/DataTypes.h.cmake b/include/llvm/System/DataTypes.h.cmake
deleted file mode 100644
index 9efe75a..0000000
--- a/include/llvm/System/DataTypes.h.cmake
+++ /dev/null
@@ -1,189 +0,0 @@
-/*===-- include/System/DataTypes.h - Define fixed size types -----*- C -*-===*\
-|* *|
-|* The LLVM Compiler Infrastructure *|
-|* *|
-|* This file is distributed under the University of Illinois Open Source *|
-|* License. See LICENSE.TXT for details. *|
-|* *|
-|*===----------------------------------------------------------------------===*|
-|* *|
-|* This file contains definitions to figure out the size of _HOST_ data types.*|
-|* This file is important because different host OS's define different macros,*|
-|* which makes portability tough. This file exports the following *|
-|* definitions: *|
-|* *|
-|* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
-|* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
-|* *|
-|* No library is required when using these functinons. *|
-|* *|
-|*===----------------------------------------------------------------------===*/
-
-/* Please leave this file C-compatible. */
-
-#ifndef SUPPORT_DATATYPES_H
-#define SUPPORT_DATATYPES_H
-
-#cmakedefine HAVE_SYS_TYPES_H ${HAVE_SYS_TYPES_H}
-#cmakedefine HAVE_INTTYPES_H ${HAVE_INTTYPES_H}
-#cmakedefine HAVE_STDINT_H ${HAVE_STDINT_H}
-#cmakedefine HAVE_UINT64_T ${HAVE_UINT64_T}
-#cmakedefine HAVE_U_INT64_T ${HAVE_U_INT64_T}
-
-#ifdef __cplusplus
-#include <cmath>
-#else
-#include <math.h>
-#endif
-
-#ifndef _MSC_VER
-
-/* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
- being defined. We would define it here, but in order to prevent Bad Things
- happening when system headers or C++ STL headers include stdint.h before we
- define it here, we define it on the g++ command line (in Makefile.rules). */
-#if !defined(__STDC_LIMIT_MACROS)
-# error "Must #define __STDC_LIMIT_MACROS before #including System/DataTypes.h"
-#endif
-
-#if !defined(__STDC_CONSTANT_MACROS)
-# error "Must #define __STDC_CONSTANT_MACROS before " \
- "#including System/DataTypes.h"
-#endif
-
-/* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
-#ifdef _AIX
-#include "llvm/System/AIXDataTypesFix.h"
-#endif
-
-/* Handle incorrect definition of uint64_t as u_int64_t */
-#ifndef HAVE_UINT64_T
-#ifdef HAVE_U_INT64_T
-typedef u_int64_t uint64_t;
-#else
-# error "Don't have a definition for uint64_t on this platform"
-#endif
-#endif
-
-#ifdef _OpenBSD_
-#define INT8_MAX 127
-#define INT8_MIN -128
-#define UINT8_MAX 255
-#define INT16_MAX 32767
-#define INT16_MIN -32768
-#define UINT16_MAX 65535
-#define INT32_MAX 2147483647
-#define INT32_MIN -2147483648
-#define UINT32_MAX 4294967295U
-#endif
-
-#else /* _MSC_VER */
-/* Visual C++ doesn't provide standard integer headers, but it does provide
- built-in data types. */
-#include <stdlib.h>
-#include <stddef.h>
-#include <sys/types.h>
-#ifdef __cplusplus
-#include <cmath>
-#else
-#include <math.h>
-#endif
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-typedef signed int int32_t;
-typedef unsigned int uint32_t;
-typedef short int16_t;
-typedef unsigned short uint16_t;
-typedef signed char int8_t;
-typedef unsigned char uint8_t;
-typedef signed int ssize_t;
-#ifndef INT8_MAX
-# define INT8_MAX 127
-#endif
-#ifndef INT8_MIN
-# define INT8_MIN -128
-#endif
-#ifndef UINT8_MAX
-# define UINT8_MAX 255
-#endif
-#ifndef INT16_MAX
-# define INT16_MAX 32767
-#endif
-#ifndef INT16_MIN
-# define INT16_MIN -32768
-#endif
-#ifndef UINT16_MAX
-# define UINT16_MAX 65535
-#endif
-#ifndef INT32_MAX
-# define INT32_MAX 2147483647
-#endif
-#ifndef INT32_MIN
-# define INT32_MIN -2147483648
-#endif
-#ifndef UINT32_MAX
-# define UINT32_MAX 4294967295U
-#endif
-/* Certain compatibility updates to VC++ introduce the `cstdint'
- * header, which defines the INT*_C macros. On default installs they
- * are absent. */
-#ifndef INT8_C
-# define INT8_C(C) C##i8
-#endif
-#ifndef UINT8_C
-# define UINT8_C(C) C##ui8
-#endif
-#ifndef INT16_C
-# define INT16_C(C) C##i16
-#endif
-#ifndef UINT16_C
-# define UINT16_C(C) C##ui16
-#endif
-#ifndef INT32_C
-# define INT32_C(C) C##i32
-#endif
-#ifndef UINT32_C
-# define UINT32_C(C) C##ui32
-#endif
-#ifndef INT64_C
-# define INT64_C(C) C##i64
-#endif
-#ifndef UINT64_C
-# define UINT64_C(C) C##ui64
-#endif
-#endif /* _MSC_VER */
-
-/* Set defaults for constants which we cannot find. */
-#if !defined(INT64_MAX)
-# define INT64_MAX 9223372036854775807LL
-#endif
-#if !defined(INT64_MIN)
-# define INT64_MIN ((-INT64_MAX)-1)
-#endif
-#if !defined(UINT64_MAX)
-# define UINT64_MAX 0xffffffffffffffffULL
-#endif
-
-#if __GNUC__ > 3
-#define END_WITH_NULL __attribute__((sentinel))
-#else
-#define END_WITH_NULL
-#endif
-
-#ifndef HUGE_VALF
-#define HUGE_VALF (float)HUGE_VAL
-#endif
-
-#endif /* SUPPORT_DATATYPES_H */
diff --git a/include/llvm/System/DataTypes.h.in b/include/llvm/System/DataTypes.h.in
deleted file mode 100644
index 6537f30..0000000
--- a/include/llvm/System/DataTypes.h.in
+++ /dev/null
@@ -1,111 +0,0 @@
-/*===-- include/System/DataTypes.h - Define fixed size types -----*- C -*-===*\
-|* *|
-|* The LLVM Compiler Infrastructure *|
-|* *|
-|* This file is distributed under the University of Illinois Open Source *|
-|* License. See LICENSE.TXT for details. *|
-|* *|
-|*===----------------------------------------------------------------------===*|
-|* *|
-|* This file contains definitions to figure out the size of _HOST_ data types.*|
-|* This file is important because different host OS's define different macros,*|
-|* which makes portability tough. This file exports the following *|
-|* definitions: *|
-|* *|
-|* [u]int(32|64)_t : typedefs for signed and unsigned 32/64 bit system types*|
-|* [U]INT(8|16|32|64)_(MIN|MAX) : Constants for the min and max values. *|
-|* *|
-|* No library is required when using these functions. *|
-|* *|
-|*===----------------------------------------------------------------------===*/
-
-/* Please leave this file C-compatible. */
-
-#ifndef SUPPORT_DATATYPES_H
-#define SUPPORT_DATATYPES_H
-
-#undef HAVE_SYS_TYPES_H
-#undef HAVE_INTTYPES_H
-#undef HAVE_STDINT_H
-#undef HAVE_UINT64_T
-#undef HAVE_U_INT64_T
-
-#ifdef __cplusplus
-#include <cmath>
-#else
-#include <math.h>
-#endif
-
-/* Note that this header's correct operation depends on __STDC_LIMIT_MACROS
- being defined. We would define it here, but in order to prevent Bad Things
- happening when system headers or C++ STL headers include stdint.h before we
- define it here, we define it on the g++ command line (in Makefile.rules). */
-#if !defined(__STDC_LIMIT_MACROS)
-# error "Must #define __STDC_LIMIT_MACROS before #including System/DataTypes.h"
-#endif
-
-#if !defined(__STDC_CONSTANT_MACROS)
-# error "Must #define __STDC_CONSTANT_MACROS before " \
- "#including System/DataTypes.h"
-#endif
-
-/* Note that <inttypes.h> includes <stdint.h>, if this is a C99 system. */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-
-#ifdef HAVE_INTTYPES_H
-#include <inttypes.h>
-#endif
-
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-
-#ifdef _AIX
-#include "llvm/System/AIXDataTypesFix.h"
-#endif
-
-/* Handle incorrect definition of uint64_t as u_int64_t */
-#ifndef HAVE_UINT64_T
-#ifdef HAVE_U_INT64_T
-typedef u_int64_t uint64_t;
-#else
-# error "Don't have a definition for uint64_t on this platform"
-#endif
-#endif
-
-#ifdef _OpenBSD_
-#define INT8_MAX 127
-#define INT8_MIN -128
-#define UINT8_MAX 255
-#define INT16_MAX 32767
-#define INT16_MIN -32768
-#define UINT16_MAX 65535
-#define INT32_MAX 2147483647
-#define INT32_MIN -2147483648
-#define UINT32_MAX 4294967295U
-#endif
-
-/* Set defaults for constants which we cannot find. */
-#if !defined(INT64_MAX)
-# define INT64_MAX 9223372036854775807LL
-#endif
-#if !defined(INT64_MIN)
-# define INT64_MIN ((-INT64_MAX)-1)
-#endif
-#if !defined(UINT64_MAX)
-# define UINT64_MAX 0xffffffffffffffffULL
-#endif
-
-#if __GNUC__ > 3
-#define END_WITH_NULL __attribute__((sentinel))
-#else
-#define END_WITH_NULL
-#endif
-
-#ifndef HUGE_VALF
-#define HUGE_VALF (float)HUGE_VAL
-#endif
-
-#endif /* SUPPORT_DATATYPES_H */
diff --git a/include/llvm/System/Disassembler.h b/include/llvm/System/Disassembler.h
deleted file mode 100644
index e11e792..0000000
--- a/include/llvm/System/Disassembler.h
+++ /dev/null
@@ -1,35 +0,0 @@
-//===- llvm/Support/Disassembler.h ------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file implements the necessary glue to call external disassembler
-// libraries.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_DISASSEMBLER_H
-#define LLVM_SYSTEM_DISASSEMBLER_H
-
-#include "llvm/System/DataTypes.h"
-#include <string>
-
-namespace llvm {
-namespace sys {
-
-/// This function returns true, if there is possible to use some external
-/// disassembler library. False otherwise.
-bool hasDisassembler();
-
-/// This function provides some "glue" code to call external disassembler
-/// libraries.
-std::string disassembleBuffer(uint8_t* start, size_t length, uint64_t pc = 0);
-
-}
-}
-
-#endif // LLVM_SYSTEM_DISASSEMBLER_H
diff --git a/include/llvm/System/DynamicLibrary.h b/include/llvm/System/DynamicLibrary.h
deleted file mode 100644
index 745b8f8..0000000
--- a/include/llvm/System/DynamicLibrary.h
+++ /dev/null
@@ -1,86 +0,0 @@
-//===-- llvm/System/DynamicLibrary.h - Portable Dynamic Library -*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the sys::DynamicLibrary class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_DYNAMIC_LIBRARY_H
-#define LLVM_SYSTEM_DYNAMIC_LIBRARY_H
-
-#include <string>
-
-namespace llvm {
-namespace sys {
-
- /// This class provides a portable interface to dynamic libraries which also
- /// might be known as shared libraries, shared objects, dynamic shared
- /// objects, or dynamic link libraries. Regardless of the terminology or the
- /// operating system interface, this class provides a portable interface that
- /// allows dynamic libraries to be loaded and searched for externally
- /// defined symbols. This is typically used to provide "plug-in" support.
- /// It also allows for symbols to be defined which don't live in any library,
- /// but rather the main program itself, useful on Windows where the main
- /// executable cannot be searched.
- class DynamicLibrary {
- DynamicLibrary(); // DO NOT IMPLEMENT
- public:
- /// This function allows a library to be loaded without instantiating a
- /// DynamicLibrary object. Consequently, it is marked as being permanent
- /// and will only be unloaded when the program terminates. This returns
- /// false on success or returns true and fills in *ErrMsg on failure.
- /// @brief Open a dynamic library permanently.
- ///
- /// NOTE: This function is not thread safe.
- ///
- static bool LoadLibraryPermanently(const char *filename,
- std::string *ErrMsg = 0);
-
- /// This function will search through all previously loaded dynamic
- /// libraries for the symbol \p symbolName. If it is found, the addressof
- /// that symbol is returned. If not, null is returned. Note that this will
- /// search permanently loaded libraries (LoadLibraryPermanently) as well
- /// as ephemerally loaded libraries (constructors).
- /// @throws std::string on error.
- /// @brief Search through libraries for address of a symbol
- ///
- /// NOTE: This function is not thread safe.
- ///
- static void *SearchForAddressOfSymbol(const char *symbolName);
-
- /// @brief Convenience function for C++ophiles.
- ///
- /// NOTE: This function is not thread safe.
- ///
- static void *SearchForAddressOfSymbol(const std::string &symbolName) {
- return SearchForAddressOfSymbol(symbolName.c_str());
- }
-
- /// This functions permanently adds the symbol \p symbolName with the
- /// value \p symbolValue. These symbols are searched before any
- /// libraries.
- /// @brief Add searchable symbol/value pair.
- ///
- /// NOTE: This function is not thread safe.
- ///
- static void AddSymbol(const char *symbolName, void *symbolValue);
-
- /// @brief Convenience function for C++ophiles.
- ///
- /// NOTE: This function is not thread safe.
- ///
- static void AddSymbol(const std::string &symbolName, void *symbolValue) {
- AddSymbol(symbolName.c_str(), symbolValue);
- }
- };
-
-} // End sys namespace
-} // End llvm namespace
-
-#endif // LLVM_SYSTEM_DYNAMIC_LIBRARY_H
diff --git a/include/llvm/System/Errno.h b/include/llvm/System/Errno.h
deleted file mode 100644
index 6e292ba..0000000
--- a/include/llvm/System/Errno.h
+++ /dev/null
@@ -1,34 +0,0 @@
-//===- llvm/System/Errno.h - Portable+convenient errno handling -*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares some portable and convenient functions to deal with errno.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_ERRNO_H
-#define LLVM_SYSTEM_ERRNO_H
-
-#include <string>
-
-namespace llvm {
-namespace sys {
-
-/// Returns a string representation of the errno value, using whatever
-/// thread-safe variant of strerror() is available. Be sure to call this
-/// immediately after the function that set errno, or errno may have been
-/// overwritten by an intervening call.
-std::string StrError();
-
-/// Like the no-argument version above, but uses \p errnum instead of errno.
-std::string StrError(int errnum);
-
-} // namespace sys
-} // namespace llvm
-
-#endif // LLVM_SYSTEM_ERRNO_H
diff --git a/include/llvm/System/FEnv.h b/include/llvm/System/FEnv.h
deleted file mode 100644
index 042e439..0000000
--- a/include/llvm/System/FEnv.h
+++ /dev/null
@@ -1,56 +0,0 @@
-//===- llvm/System/FEnv.h - Host floating-point exceptions ------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file provides an operating system independent interface to
-// floating-point exception interfaces.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_FENV_H
-#define LLVM_SYSTEM_FENV_H
-
-#include "llvm/Config/config.h"
-#include <cerrno>
-#ifdef HAVE_FENV_H
-#include <fenv.h>
-#endif
-
-// FIXME: Clang's #include handling apparently doesn't work for libstdc++'s
-// fenv.h; see PR6907 for details.
-#if defined(__clang__) && defined(_GLIBCXX_FENV_H)
-#undef HAVE_FENV_H
-#endif
-
-namespace llvm {
-namespace sys {
-
-/// llvm_fenv_clearexcept - Clear the floating-point exception state.
-static inline void llvm_fenv_clearexcept() {
-#ifdef HAVE_FENV_H
- feclearexcept(FE_ALL_EXCEPT);
-#endif
- errno = 0;
-}
-
-/// llvm_fenv_testexcept - Test if a floating-point exception was raised.
-static inline bool llvm_fenv_testexcept() {
- int errno_val = errno;
- if (errno_val == ERANGE || errno_val == EDOM)
- return true;
-#ifdef HAVE_FENV_H
- if (fetestexcept(FE_ALL_EXCEPT & ~FE_INEXACT))
- return true;
-#endif
- return false;
-}
-
-} // End sys namespace
-} // End llvm namespace
-
-#endif
diff --git a/include/llvm/System/Host.h b/include/llvm/System/Host.h
deleted file mode 100644
index 4fbf5c1..0000000
--- a/include/llvm/System/Host.h
+++ /dev/null
@@ -1,66 +0,0 @@
-//===- llvm/System/Host.h - Host machine characteristics --------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Methods for querying the nature of the host machine.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_HOST_H
-#define LLVM_SYSTEM_HOST_H
-
-#include "llvm/ADT/StringMap.h"
-#include <string>
-
-namespace llvm {
-namespace sys {
-
- inline bool isLittleEndianHost() {
- union {
- int i;
- char c;
- };
- i = 1;
- return c;
- }
-
- inline bool isBigEndianHost() {
- return !isLittleEndianHost();
- }
-
- /// getHostTriple() - Return the target triple of the running
- /// system.
- ///
- /// The target triple is a string in the format of:
- /// CPU_TYPE-VENDOR-OPERATING_SYSTEM
- /// or
- /// CPU_TYPE-VENDOR-KERNEL-OPERATING_SYSTEM
- std::string getHostTriple();
-
- /// getHostCPUName - Get the LLVM name for the host CPU. The particular format
- /// of the name is target dependent, and suitable for passing as -mcpu to the
- /// target which matches the host.
- ///
- /// \return - The host CPU name, or empty if the CPU could not be determined.
- std::string getHostCPUName();
-
- /// getHostCPUFeatures - Get the LLVM names for the host CPU features.
- /// The particular format of the names are target dependent, and suitable for
- /// passing as -mattr to the target which matches the host.
- ///
- /// \param Features - A string mapping feature names to either
- /// true (if enabled) or false (if disabled). This routine makes no guarantees
- /// about exactly which features may appear in this map, except that they are
- /// all valid LLVM feature names.
- ///
- /// \return - True on success.
- bool getHostCPUFeatures(StringMap<bool> &Features);
-}
-}
-
-#endif
diff --git a/include/llvm/System/IncludeFile.h b/include/llvm/System/IncludeFile.h
deleted file mode 100644
index 3268ea2..0000000
--- a/include/llvm/System/IncludeFile.h
+++ /dev/null
@@ -1,79 +0,0 @@
-//===- llvm/System/IncludeFile.h - Ensure Linking Of Library ---*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines the FORCE_DEFINING_FILE_TO_BE_LINKED and DEFINE_FILE_FOR
-// macros.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_INCLUDEFILE_H
-#define LLVM_SYSTEM_INCLUDEFILE_H
-
-/// This macro is the public interface that IncludeFile.h exports. This gives
-/// us the option to implement the "link the definition" capability in any
-/// manner that we choose. All header files that depend on a specific .cpp
-/// file being linked at run time should use this macro instead of the
-/// IncludeFile class directly.
-///
-/// For example, foo.h would use:<br/>
-/// <tt>FORCE_DEFINING_FILE_TO_BE_LINKED(foo)</tt><br/>
-///
-/// And, foo.cp would use:<br/>
-/// <tt>DEFINING_FILE_FOR(foo)</tt><br/>
-#ifdef __GNUC__
-// If the `used' attribute is available, use it to create a variable
-// with an initializer that will force the linking of the defining file.
-#define FORCE_DEFINING_FILE_TO_BE_LINKED(name) \
- namespace llvm { \
- extern const char name ## LinkVar; \
- __attribute__((used)) static const char *const name ## LinkObj = \
- &name ## LinkVar; \
- }
-#else
-// Otherwise use a constructor call.
-#define FORCE_DEFINING_FILE_TO_BE_LINKED(name) \
- namespace llvm { \
- extern const char name ## LinkVar; \
- static const IncludeFile name ## LinkObj ( &name ## LinkVar ); \
- }
-#endif
-
-/// This macro is the counterpart to FORCE_DEFINING_FILE_TO_BE_LINKED. It should
-/// be used in a .cpp file to define the name referenced in a header file that
-/// will cause linkage of the .cpp file. It should only be used at extern level.
-#define DEFINING_FILE_FOR(name) \
- namespace llvm { const char name ## LinkVar = 0; }
-
-namespace llvm {
-
-/// This class is used in the implementation of FORCE_DEFINING_FILE_TO_BE_LINKED
-/// macro to make sure that the implementation of a header file is included
-/// into a tool that uses the header. This is solely
-/// to overcome problems linking .a files and not getting the implementation
-/// of compilation units we need. This is commonly an issue with the various
-/// Passes but also occurs elsewhere in LLVM. We like to use .a files because
-/// they link faster and provide the smallest executables. However, sometimes
-/// those executables are too small, if the program doesn't reference something
-/// that might be needed, especially by a loaded share object. This little class
-/// helps to resolve that problem. The basic strategy is to use this class in
-/// a header file and pass the address of a variable to the constructor. If the
-/// variable is defined in the header file's corresponding .cpp file then all
-/// tools/libraries that \#include the header file will require the .cpp as
-/// well.
-/// For example:<br/>
-/// <tt>extern int LinkMyCodeStub;</tt><br/>
-/// <tt>static IncludeFile LinkMyModule(&LinkMyCodeStub);</tt><br/>
-/// @brief Class to ensure linking of corresponding object file.
-struct IncludeFile {
- explicit IncludeFile(const void *);
-};
-
-}
-
-#endif
diff --git a/include/llvm/System/LICENSE.TXT b/include/llvm/System/LICENSE.TXT
deleted file mode 100644
index f569da2..0000000
--- a/include/llvm/System/LICENSE.TXT
+++ /dev/null
@@ -1,6 +0,0 @@
-LLVM System Interface Library
--------------------------------------------------------------------------------
-The LLVM System Interface Library is licensed under the Illinois Open Source
-License and has the following additional copyright:
-
-Copyright (C) 2004 eXtensible Systems, Inc.
diff --git a/include/llvm/System/Memory.h b/include/llvm/System/Memory.h
deleted file mode 100644
index 2dd36e8..0000000
--- a/include/llvm/System/Memory.h
+++ /dev/null
@@ -1,96 +0,0 @@
-//===- llvm/System/Memory.h - Memory Support --------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the llvm::sys::Memory class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_MEMORY_H
-#define LLVM_SYSTEM_MEMORY_H
-
-#include "llvm/System/DataTypes.h"
-#include <string>
-
-namespace llvm {
-namespace sys {
-
- /// This class encapsulates the notion of a memory block which has an address
- /// and a size. It is used by the Memory class (a friend) as the result of
- /// various memory allocation operations.
- /// @see Memory
- /// @brief Memory block abstraction.
- class MemoryBlock {
- public:
- MemoryBlock() : Address(0), Size(0) { }
- MemoryBlock(void *addr, size_t size) : Address(addr), Size(size) { }
- void *base() const { return Address; }
- size_t size() const { return Size; }
- private:
- void *Address; ///< Address of first byte of memory area
- size_t Size; ///< Size, in bytes of the memory area
- friend class Memory;
- };
-
- /// This class provides various memory handling functions that manipulate
- /// MemoryBlock instances.
- /// @since 1.4
- /// @brief An abstraction for memory operations.
- class Memory {
- public:
- /// This method allocates a block of Read/Write/Execute memory that is
- /// suitable for executing dynamically generated code (e.g. JIT). An
- /// attempt to allocate \p NumBytes bytes of virtual memory is made.
- /// \p NearBlock may point to an existing allocation in which case
- /// an attempt is made to allocate more memory near the existing block.
- ///
- /// On success, this returns a non-null memory block, otherwise it returns
- /// a null memory block and fills in *ErrMsg.
- ///
- /// @brief Allocate Read/Write/Execute memory.
- static MemoryBlock AllocateRWX(size_t NumBytes,
- const MemoryBlock *NearBlock,
- std::string *ErrMsg = 0);
-
- /// This method releases a block of Read/Write/Execute memory that was
- /// allocated with the AllocateRWX method. It should not be used to
- /// release any memory block allocated any other way.
- ///
- /// On success, this returns false, otherwise it returns true and fills
- /// in *ErrMsg.
- /// @brief Release Read/Write/Execute memory.
- static bool ReleaseRWX(MemoryBlock &block, std::string *ErrMsg = 0);
-
-
- /// InvalidateInstructionCache - Before the JIT can run a block of code
- /// that has been emitted it must invalidate the instruction cache on some
- /// platforms.
- static void InvalidateInstructionCache(const void *Addr, size_t Len);
-
- /// setExecutable - Before the JIT can run a block of code, it has to be
- /// given read and executable privilege. Return true if it is already r-x
- /// or the system is able to change its previlege.
- static bool setExecutable (MemoryBlock &M, std::string *ErrMsg = 0);
-
- /// setWritable - When adding to a block of code, the JIT may need
- /// to mark a block of code as RW since the protections are on page
- /// boundaries, and the JIT internal allocations are not page aligned.
- static bool setWritable (MemoryBlock &M, std::string *ErrMsg = 0);
-
- /// setRangeExecutable - Mark the page containing a range of addresses
- /// as executable.
- static bool setRangeExecutable(const void *Addr, size_t Size);
-
- /// setRangeWritable - Mark the page containing a range of addresses
- /// as writable.
- static bool setRangeWritable(const void *Addr, size_t Size);
- };
-}
-}
-
-#endif
diff --git a/include/llvm/System/Mutex.h b/include/llvm/System/Mutex.h
deleted file mode 100644
index 71d1006..0000000
--- a/include/llvm/System/Mutex.h
+++ /dev/null
@@ -1,154 +0,0 @@
-//===- llvm/System/Mutex.h - Mutex Operating System Concept -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the llvm::sys::Mutex class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_MUTEX_H
-#define LLVM_SYSTEM_MUTEX_H
-
-#include "llvm/System/Threading.h"
-#include <cassert>
-
-namespace llvm
-{
- namespace sys
- {
- /// @brief Platform agnostic Mutex class.
- class MutexImpl
- {
- /// @name Constructors
- /// @{
- public:
-
- /// Initializes the lock but doesn't acquire it. if \p recursive is set
- /// to false, the lock will not be recursive which makes it cheaper but
- /// also more likely to deadlock (same thread can't acquire more than
- /// once).
- /// @brief Default Constructor.
- explicit MutexImpl(bool recursive = true);
-
- /// Releases and removes the lock
- /// @brief Destructor
- ~MutexImpl();
-
- /// @}
- /// @name Methods
- /// @{
- public:
-
- /// Attempts to unconditionally acquire the lock. If the lock is held by
- /// another thread, this method will wait until it can acquire the lock.
- /// @returns false if any kind of error occurs, true otherwise.
- /// @brief Unconditionally acquire the lock.
- bool acquire();
-
- /// Attempts to release the lock. If the lock is held by the current
- /// thread, the lock is released allowing other threads to acquire the
- /// lock.
- /// @returns false if any kind of error occurs, true otherwise.
- /// @brief Unconditionally release the lock.
- bool release();
-
- /// Attempts to acquire the lock without blocking. If the lock is not
- /// available, this function returns false quickly (without blocking). If
- /// the lock is available, it is acquired.
- /// @returns false if any kind of error occurs or the lock is not
- /// available, true otherwise.
- /// @brief Try to acquire the lock.
- bool tryacquire();
-
- //@}
- /// @name Platform Dependent Data
- /// @{
- private:
- void* data_; ///< We don't know what the data will be
-
- /// @}
- /// @name Do Not Implement
- /// @{
- private:
- MutexImpl(const MutexImpl & original);
- void operator=(const MutexImpl &);
- /// @}
- };
-
-
- /// SmartMutex - A mutex with a compile time constant parameter that
- /// indicates whether this mutex should become a no-op when we're not
- /// running in multithreaded mode.
- template<bool mt_only>
- class SmartMutex : public MutexImpl {
- unsigned acquired;
- bool recursive;
- public:
- explicit SmartMutex(bool rec = true) :
- MutexImpl(rec), acquired(0), recursive(rec) { }
-
- bool acquire() {
- if (!mt_only || llvm_is_multithreaded()) {
- return MutexImpl::acquire();
- } else {
- // Single-threaded debugging code. This would be racy in
- // multithreaded mode, but provides not sanity checks in single
- // threaded mode.
- assert((recursive || acquired == 0) && "Lock already acquired!!");
- ++acquired;
- return true;
- }
- }
-
- bool release() {
- if (!mt_only || llvm_is_multithreaded()) {
- return MutexImpl::release();
- } else {
- // Single-threaded debugging code. This would be racy in
- // multithreaded mode, but provides not sanity checks in single
- // threaded mode.
- assert(((recursive && acquired) || (acquired == 1)) &&
- "Lock not acquired before release!");
- --acquired;
- return true;
- }
- }
-
- bool tryacquire() {
- if (!mt_only || llvm_is_multithreaded())
- return MutexImpl::tryacquire();
- else return true;
- }
-
- private:
- SmartMutex(const SmartMutex<mt_only> & original);
- void operator=(const SmartMutex<mt_only> &);
- };
-
- /// Mutex - A standard, always enforced mutex.
- typedef SmartMutex<false> Mutex;
-
- template<bool mt_only>
- class SmartScopedLock {
- SmartMutex<mt_only>& mtx;
-
- public:
- SmartScopedLock(SmartMutex<mt_only>& m) : mtx(m) {
- mtx.acquire();
- }
-
- ~SmartScopedLock() {
- mtx.release();
- }
- };
-
- typedef SmartScopedLock<false> ScopedLock;
- }
-}
-
-#endif
diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h
deleted file mode 100644
index eca9dd9..0000000
--- a/include/llvm/System/Path.h
+++ /dev/null
@@ -1,738 +0,0 @@
-//===- llvm/System/Path.h - Path Operating System Concept -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the llvm::sys::Path class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_PATH_H
-#define LLVM_SYSTEM_PATH_H
-
-#include "llvm/ADT/StringRef.h"
-#include "llvm/System/TimeValue.h"
-#include <set>
-#include <string>
-#include <vector>
-
-namespace llvm {
-namespace sys {
-
- /// This structure provides basic file system information about a file. It
- /// is patterned after the stat(2) Unix operating system call but made
- /// platform independent and eliminates many of the unix-specific fields.
- /// However, to support llvm-ar, the mode, user, and group fields are
- /// retained. These pertain to unix security and may not have a meaningful
- /// value on non-Unix platforms. However, the other fields should
- /// always be applicable on all platforms. The structure is filled in by
- /// the PathWithStatus class.
- /// @brief File status structure
- class FileStatus {
- public:
- uint64_t fileSize; ///< Size of the file in bytes
- TimeValue modTime; ///< Time of file's modification
- uint32_t mode; ///< Mode of the file, if applicable
- uint32_t user; ///< User ID of owner, if applicable
- uint32_t group; ///< Group ID of owner, if applicable
- uint64_t uniqueID; ///< A number to uniquely ID this file
- bool isDir : 1; ///< True if this is a directory.
- bool isFile : 1; ///< True if this is a file.
-
- FileStatus() : fileSize(0), modTime(0,0), mode(0777), user(999),
- group(999), uniqueID(0), isDir(false), isFile(false) { }
-
- TimeValue getTimestamp() const { return modTime; }
- uint64_t getSize() const { return fileSize; }
- uint32_t getMode() const { return mode; }
- uint32_t getUser() const { return user; }
- uint32_t getGroup() const { return group; }
- uint64_t getUniqueID() const { return uniqueID; }
- };
-
- /// This class provides an abstraction for the path to a file or directory
- /// in the operating system's filesystem and provides various basic operations
- /// on it. Note that this class only represents the name of a path to a file
- /// or directory which may or may not be valid for a given machine's file
- /// system. The class is patterned after the java.io.File class with various
- /// extensions and several omissions (not relevant to LLVM). A Path object
- /// ensures that the path it encapsulates is syntactically valid for the
- /// operating system it is running on but does not ensure correctness for
- /// any particular file system. That is, a syntactically valid path might
- /// specify path components that do not exist in the file system and using
- /// such a Path to act on the file system could produce errors. There is one
- /// invalid Path value which is permitted: the empty path. The class should
- /// never allow a syntactically invalid non-empty path name to be assigned.
- /// Empty paths are required in order to indicate an error result in some
- /// situations. If the path is empty, the isValid operation will return
- /// false. All operations will fail if isValid is false. Operations that
- /// change the path will either return false if it would cause a syntactically
- /// invalid path name (in which case the Path object is left unchanged) or
- /// throw an std::string exception indicating the error. The methods are
- /// grouped into four basic categories: Path Accessors (provide information
- /// about the path without accessing disk), Disk Accessors (provide
- /// information about the underlying file or directory), Path Mutators
- /// (change the path information, not the disk), and Disk Mutators (change
- /// the disk file/directory referenced by the path). The Disk Mutator methods
- /// all have the word "disk" embedded in their method name to reinforce the
- /// notion that the operation modifies the file system.
- /// @since 1.4
- /// @brief An abstraction for operating system paths.
- class Path {
- /// @name Constructors
- /// @{
- public:
- /// Construct a path to the root directory of the file system. The root
- /// directory is a top level directory above which there are no more
- /// directories. For example, on UNIX, the root directory is /. On Windows
- /// it is file:///. Other operating systems may have different notions of
- /// what the root directory is or none at all. In that case, a consistent
- /// default root directory will be used.
- static Path GetRootDirectory();
-
- /// Construct a path to a unique temporary directory that is created in
- /// a "standard" place for the operating system. The directory is
- /// guaranteed to be created on exit from this function. If the directory
- /// cannot be created, the function will throw an exception.
- /// @returns an invalid path (empty) on error
- /// @param ErrMsg Optional place for an error message if an error occurs
- /// @brief Constrct a path to an new, unique, existing temporary
- /// directory.
- static Path GetTemporaryDirectory(std::string* ErrMsg = 0);
-
- /// Construct a vector of sys::Path that contains the "standard" system
- /// library paths suitable for linking into programs.
- /// @brief Construct a path to the system library directory
- static void GetSystemLibraryPaths(std::vector<sys::Path>& Paths);
-
- /// Construct a vector of sys::Path that contains the "standard" bitcode
- /// library paths suitable for linking into an llvm program. This function
- /// *must* return the value of LLVM_LIB_SEARCH_PATH as well as the value
- /// of LLVM_LIBDIR. It also must provide the System library paths as
- /// returned by GetSystemLibraryPaths.
- /// @see GetSystemLibraryPaths
- /// @brief Construct a list of directories in which bitcode could be
- /// found.
- static void GetBitcodeLibraryPaths(std::vector<sys::Path>& Paths);
-
- /// Find the path to a library using its short name. Use the system
- /// dependent library paths to locate the library.
- /// @brief Find a library.
- static Path FindLibrary(std::string& short_name);
-
- /// Construct a path to the default LLVM configuration directory. The
- /// implementation must ensure that this is a well-known (same on many
- /// systems) directory in which llvm configuration files exist. For
- /// example, on Unix, the /etc/llvm directory has been selected.
- /// @brief Construct a path to the default LLVM configuration directory
- static Path GetLLVMDefaultConfigDir();
-
- /// Construct a path to the LLVM installed configuration directory. The
- /// implementation must ensure that this refers to the "etc" directory of
- /// the LLVM installation. This is the location where configuration files
- /// will be located for a particular installation of LLVM on a machine.
- /// @brief Construct a path to the LLVM installed configuration directory
- static Path GetLLVMConfigDir();
-
- /// Construct a path to the current user's home directory. The
- /// implementation must use an operating system specific mechanism for
- /// determining the user's home directory. For example, the environment
- /// variable "HOME" could be used on Unix. If a given operating system
- /// does not have the concept of a user's home directory, this static
- /// constructor must provide the same result as GetRootDirectory.
- /// @brief Construct a path to the current user's "home" directory
- static Path GetUserHomeDirectory();
-
- /// Construct a path to the current directory for the current process.
- /// @returns The current working directory.
- /// @brief Returns the current working directory.
- static Path GetCurrentDirectory();
-
- /// Return the suffix commonly used on file names that contain an
- /// executable.
- /// @returns The executable file suffix for the current platform.
- /// @brief Return the executable file suffix.
- static StringRef GetEXESuffix();
-
- /// Return the suffix commonly used on file names that contain a shared
- /// object, shared archive, or dynamic link library. Such files are
- /// linked at runtime into a process and their code images are shared
- /// between processes.
- /// @returns The dynamic link library suffix for the current platform.
- /// @brief Return the dynamic link library suffix.
- static StringRef GetDLLSuffix();
-
- /// GetMainExecutable - Return the path to the main executable, given the
- /// value of argv[0] from program startup and the address of main itself.
- /// In extremis, this function may fail and return an empty path.
- static Path GetMainExecutable(const char *argv0, void *MainAddr);
-
- /// This is one of the very few ways in which a path can be constructed
- /// with a syntactically invalid name. The only *legal* invalid name is an
- /// empty one. Other invalid names are not permitted. Empty paths are
- /// provided so that they can be used to indicate null or error results in
- /// other lib/System functionality.
- /// @brief Construct an empty (and invalid) path.
- Path() : path() {}
- Path(const Path &that) : path(that.path) {}
-
- /// This constructor will accept a char* or std::string as a path. No
- /// checking is done on this path to determine if it is valid. To
- /// determine validity of the path, use the isValid method.
- /// @param p The path to assign.
- /// @brief Construct a Path from a string.
- explicit Path(StringRef p);
-
- /// This constructor will accept a character range as a path. No checking
- /// is done on this path to determine if it is valid. To determine
- /// validity of the path, use the isValid method.
- /// @param StrStart A pointer to the first character of the path name
- /// @param StrLen The length of the path name at StrStart
- /// @brief Construct a Path from a string.
- Path(const char *StrStart, unsigned StrLen);
-
- /// @}
- /// @name Operators
- /// @{
- public:
- /// Makes a copy of \p that to \p this.
- /// @returns \p this
- /// @brief Assignment Operator
- Path &operator=(const Path &that) {
- path = that.path;
- return *this;
- }
-
- /// Makes a copy of \p that to \p this.
- /// @param that A StringRef denoting the path
- /// @returns \p this
- /// @brief Assignment Operator
- Path &operator=(StringRef that);
-
- /// Compares \p this Path with \p that Path for equality.
- /// @returns true if \p this and \p that refer to the same thing.
- /// @brief Equality Operator
- bool operator==(const Path &that) const;
-
- /// Compares \p this Path with \p that Path for inequality.
- /// @returns true if \p this and \p that refer to different things.
- /// @brief Inequality Operator
- bool operator!=(const Path &that) const { return !(*this == that); }
-
- /// Determines if \p this Path is less than \p that Path. This is required
- /// so that Path objects can be placed into ordered collections (e.g.
- /// std::map). The comparison is done lexicographically as defined by
- /// the std::string::compare method.
- /// @returns true if \p this path is lexicographically less than \p that.
- /// @brief Less Than Operator
- bool operator<(const Path& that) const;
-
- /// @}
- /// @name Path Accessors
- /// @{
- public:
- /// This function will use an operating system specific algorithm to
- /// determine if the current value of \p this is a syntactically valid
- /// path name for the operating system. The path name does not need to
- /// exist, validity is simply syntactical. Empty paths are always invalid.
- /// @returns true iff the path name is syntactically legal for the
- /// host operating system.
- /// @brief Determine if a path is syntactically valid or not.
- bool isValid() const;
-
- /// This function determines if the contents of the path name are empty.
- /// That is, the path name has a zero length. This does NOT determine if
- /// if the file is empty. To get the length of the file itself, Use the
- /// PathWithStatus::getFileStatus() method and then the getSize() method
- /// on the returned FileStatus object.
- /// @returns true iff the path is empty.
- /// @brief Determines if the path name is empty (invalid).
- bool isEmpty() const { return path.empty(); }
-
- /// This function returns the last component of the path name. The last
- /// component is the file or directory name occuring after the last
- /// directory separator. If no directory separator is present, the entire
- /// path name is returned (i.e. same as toString).
- /// @returns StringRef containing the last component of the path name.
- /// @brief Returns the last component of the path name.
- StringRef getLast() const;
-
- /// This function strips off the path and suffix of the file or directory
- /// name and returns just the basename. For example /a/foo.bar would cause
- /// this function to return "foo".
- /// @returns StringRef containing the basename of the path
- /// @brief Get the base name of the path
- StringRef getBasename() const;
-
- /// This function strips off the suffix of the path beginning with the
- /// path separator ('/' on Unix, '\' on Windows) and returns the result.
- StringRef getDirname() const;
-
- /// This function strips off the path and basename(up to and
- /// including the last dot) of the file or directory name and
- /// returns just the suffix. For example /a/foo.bar would cause
- /// this function to return "bar".
- /// @returns StringRef containing the suffix of the path
- /// @brief Get the suffix of the path
- StringRef getSuffix() const;
-
- /// Obtain a 'C' string for the path name.
- /// @returns a 'C' string containing the path name.
- /// @brief Returns the path as a C string.
- const char *c_str() const { return path.c_str(); }
- const std::string &str() const { return path; }
-
-
- /// size - Return the length in bytes of this path name.
- size_t size() const { return path.size(); }
-
- /// empty - Returns true if the path is empty.
- unsigned empty() const { return path.empty(); }
-
- /// @}
- /// @name Disk Accessors
- /// @{
- public:
- /// This function determines if the path name is absolute, as opposed to
- /// relative.
- /// @brief Determine if the path is absolute.
- bool isAbsolute() const;
-
- /// This function determines if the path name is absolute, as opposed to
- /// relative.
- /// @brief Determine if the path is absolute.
- static bool isAbsolute(const char *NameStart, unsigned NameLen);
-
- /// This function opens the file associated with the path name provided by
- /// the Path object and reads its magic number. If the magic number at the
- /// start of the file matches \p magic, true is returned. In all other
- /// cases (file not found, file not accessible, etc.) it returns false.
- /// @returns true if the magic number of the file matches \p magic.
- /// @brief Determine if file has a specific magic number
- bool hasMagicNumber(StringRef magic) const;
-
- /// This function retrieves the first \p len bytes of the file associated
- /// with \p this. These bytes are returned as the "magic number" in the
- /// \p Magic parameter.
- /// @returns true if the Path is a file and the magic number is retrieved,
- /// false otherwise.
- /// @brief Get the file's magic number.
- bool getMagicNumber(std::string& Magic, unsigned len) const;
-
- /// This function determines if the path name in the object references an
- /// archive file by looking at its magic number.
- /// @returns true if the file starts with the magic number for an archive
- /// file.
- /// @brief Determine if the path references an archive file.
- bool isArchive() const;
-
- /// This function determines if the path name in the object references an
- /// LLVM Bitcode file by looking at its magic number.
- /// @returns true if the file starts with the magic number for LLVM
- /// bitcode files.
- /// @brief Determine if the path references a bitcode file.
- bool isBitcodeFile() const;
-
- /// This function determines if the path name in the object references a
- /// native Dynamic Library (shared library, shared object) by looking at
- /// the file's magic number. The Path object must reference a file, not a
- /// directory.
- /// @returns true if the file starts with the magic number for a native
- /// shared library.
- /// @brief Determine if the path references a dynamic library.
- bool isDynamicLibrary() const;
-
- /// This function determines if the path name in the object references a
- /// native object file by looking at it's magic number. The term object
- /// file is defined as "an organized collection of separate, named
- /// sequences of binary data." This covers the obvious file formats such
- /// as COFF and ELF, but it also includes llvm ir bitcode, archives,
- /// libraries, etc...
- /// @returns true if the file starts with the magic number for an object
- /// file.
- /// @brief Determine if the path references an object file.
- bool isObjectFile() const;
-
- /// This function determines if the path name references an existing file
- /// or directory in the file system.
- /// @returns true if the pathname references an existing file or
- /// directory.
- /// @brief Determines if the path is a file or directory in
- /// the file system.
- bool exists() const;
-
- /// This function determines if the path name references an
- /// existing directory.
- /// @returns true if the pathname references an existing directory.
- /// @brief Determines if the path is a directory in the file system.
- bool isDirectory() const;
-
- /// This function determines if the path name references an
- /// existing symbolic link.
- /// @returns true if the pathname references an existing symlink.
- /// @brief Determines if the path is a symlink in the file system.
- bool isSymLink() const;
-
- /// This function determines if the path name references a readable file
- /// or directory in the file system. This function checks for
- /// the existence and readability (by the current program) of the file
- /// or directory.
- /// @returns true if the pathname references a readable file.
- /// @brief Determines if the path is a readable file or directory
- /// in the file system.
- bool canRead() const;
-
- /// This function determines if the path name references a writable file
- /// or directory in the file system. This function checks for the
- /// existence and writability (by the current program) of the file or
- /// directory.
- /// @returns true if the pathname references a writable file.
- /// @brief Determines if the path is a writable file or directory
- /// in the file system.
- bool canWrite() const;
-
- /// This function checks that what we're trying to work only on a regular
- /// file. Check for things like /dev/null, any block special file, or
- /// other things that aren't "regular" regular files.
- /// @returns true if the file is S_ISREG.
- /// @brief Determines if the file is a regular file
- bool isRegularFile() const;
-
- /// This function determines if the path name references an executable
- /// file in the file system. This function checks for the existence and
- /// executability (by the current program) of the file.
- /// @returns true if the pathname references an executable file.
- /// @brief Determines if the path is an executable file in the file
- /// system.
- bool canExecute() const;
-
- /// This function builds a list of paths that are the names of the
- /// files and directories in a directory.
- /// @returns true if an error occurs, true otherwise
- /// @brief Build a list of directory's contents.
- bool getDirectoryContents(
- std::set<Path> &paths, ///< The resulting list of file & directory names
- std::string* ErrMsg ///< Optional place to return an error message.
- ) const;
-
- /// @}
- /// @name Path Mutators
- /// @{
- public:
- /// The path name is cleared and becomes empty. This is an invalid
- /// path name but is the *only* invalid path name. This is provided
- /// so that path objects can be used to indicate the lack of a
- /// valid path being found.
- /// @brief Make the path empty.
- void clear() { path.clear(); }
-
- /// This method sets the Path object to \p unverified_path. This can fail
- /// if the \p unverified_path does not pass the syntactic checks of the
- /// isValid() method. If verification fails, the Path object remains
- /// unchanged and false is returned. Otherwise true is returned and the
- /// Path object takes on the path value of \p unverified_path
- /// @returns true if the path was set, false otherwise.
- /// @param unverified_path The path to be set in Path object.
- /// @brief Set a full path from a StringRef
- bool set(StringRef unverified_path);
-
- /// One path component is removed from the Path. If only one component is
- /// present in the path, the Path object becomes empty. If the Path object
- /// is empty, no change is made.
- /// @returns false if the path component could not be removed.
- /// @brief Removes the last directory component of the Path.
- bool eraseComponent();
-
- /// The \p component is added to the end of the Path if it is a legal
- /// name for the operating system. A directory separator will be added if
- /// needed.
- /// @returns false if the path component could not be added.
- /// @brief Appends one path component to the Path.
- bool appendComponent(StringRef component);
-
- /// A period and the \p suffix are appended to the end of the pathname.
- /// The precondition for this function is that the Path reference a file
- /// name (i.e. isFile() returns true). If the Path is not a file, no
- /// action is taken and the function returns false. If the path would
- /// become invalid for the host operating system, false is returned. When
- /// the \p suffix is empty, no action is performed.
- /// @returns false if the suffix could not be added, true if it was.
- /// @brief Adds a period and the \p suffix to the end of the pathname.
- bool appendSuffix(StringRef suffix);
-
- /// The suffix of the filename is erased. The suffix begins with and
- /// includes the last . character in the filename after the last directory
- /// separator and extends until the end of the name. If no . character is
- /// after the last directory separator, then the file name is left
- /// unchanged (i.e. it was already without a suffix) but the function
- /// returns false.
- /// @returns false if there was no suffix to remove, true otherwise.
- /// @brief Remove the suffix from a path name.
- bool eraseSuffix();
-
- /// The current Path name is made unique in the file system. Upon return,
- /// the Path will have been changed to make a unique file in the file
- /// system or it will not have been changed if the current path name is
- /// already unique.
- /// @throws std::string if an unrecoverable error occurs.
- /// @brief Make the current path name unique in the file system.
- bool makeUnique( bool reuse_current /*= true*/, std::string* ErrMsg );
-
- /// The current Path name is made absolute by prepending the
- /// current working directory if necessary.
- void makeAbsolute();
-
- /// @}
- /// @name Disk Mutators
- /// @{
- public:
- /// This method attempts to make the file referenced by the Path object
- /// available for reading so that the canRead() method will return true.
- /// @brief Make the file readable;
- bool makeReadableOnDisk(std::string* ErrMsg = 0);
-
- /// This method attempts to make the file referenced by the Path object
- /// available for writing so that the canWrite() method will return true.
- /// @brief Make the file writable;
- bool makeWriteableOnDisk(std::string* ErrMsg = 0);
-
- /// This method attempts to make the file referenced by the Path object
- /// available for execution so that the canExecute() method will return
- /// true.
- /// @brief Make the file readable;
- bool makeExecutableOnDisk(std::string* ErrMsg = 0);
-
- /// This method allows the last modified time stamp and permission bits
- /// to be set on the disk object referenced by the Path.
- /// @throws std::string if an error occurs.
- /// @returns true on error.
- /// @brief Set the status information.
- bool setStatusInfoOnDisk(const FileStatus &SI,
- std::string *ErrStr = 0) const;
-
- /// This method attempts to create a directory in the file system with the
- /// same name as the Path object. The \p create_parents parameter controls
- /// whether intermediate directories are created or not. if \p
- /// create_parents is true, then an attempt will be made to create all
- /// intermediate directories, as needed. If \p create_parents is false,
- /// then only the final directory component of the Path name will be
- /// created. The created directory will have no entries.
- /// @returns true if the directory could not be created, false otherwise
- /// @brief Create the directory this Path refers to.
- bool createDirectoryOnDisk(
- bool create_parents = false, ///< Determines whether non-existent
- ///< directory components other than the last one (the "parents")
- ///< are created or not.
- std::string* ErrMsg = 0 ///< Optional place to put error messages.
- );
-
- /// This method attempts to create a file in the file system with the same
- /// name as the Path object. The intermediate directories must all exist
- /// at the time this method is called. Use createDirectoriesOnDisk to
- /// accomplish that. The created file will be empty upon return from this
- /// function.
- /// @returns true if the file could not be created, false otherwise.
- /// @brief Create the file this Path refers to.
- bool createFileOnDisk(
- std::string* ErrMsg = 0 ///< Optional place to put error messages.
- );
-
- /// This is like createFile except that it creates a temporary file. A
- /// unique temporary file name is generated based on the contents of
- /// \p this before the call. The new name is assigned to \p this and the
- /// file is created. Note that this will both change the Path object
- /// *and* create the corresponding file. This function will ensure that
- /// the newly generated temporary file name is unique in the file system.
- /// @returns true if the file couldn't be created, false otherwise.
- /// @brief Create a unique temporary file
- bool createTemporaryFileOnDisk(
- bool reuse_current = false, ///< When set to true, this parameter
- ///< indicates that if the current file name does not exist then
- ///< it will be used without modification.
- std::string* ErrMsg = 0 ///< Optional place to put error messages
- );
-
- /// This method renames the file referenced by \p this as \p newName. The
- /// file referenced by \p this must exist. The file referenced by
- /// \p newName does not need to exist.
- /// @returns true on error, false otherwise
- /// @brief Rename one file as another.
- bool renamePathOnDisk(const Path& newName, std::string* ErrMsg);
-
- /// This method attempts to destroy the file or directory named by the
- /// last component of the Path. If the Path refers to a directory and the
- /// \p destroy_contents is false, an attempt will be made to remove just
- /// the directory (the final Path component). If \p destroy_contents is
- /// true, an attempt will be made to remove the entire contents of the
- /// directory, recursively. If the Path refers to a file, the
- /// \p destroy_contents parameter is ignored.
- /// @param destroy_contents Indicates whether the contents of a destroyed
- /// @param Err An optional string to receive an error message.
- /// directory should also be destroyed (recursively).
- /// @returns false if the file/directory was destroyed, true on error.
- /// @brief Removes the file or directory from the filesystem.
- bool eraseFromDisk(bool destroy_contents = false,
- std::string *Err = 0) const;
-
-
- /// MapInFilePages - This is a low level system API to map in the file
- /// that is currently opened as FD into the current processes' address
- /// space for read only access. This function may return null on failure
- /// or if the system cannot provide the following constraints:
- /// 1) The pages must be valid after the FD is closed, until
- /// UnMapFilePages is called.
- /// 2) Any padding after the end of the file must be zero filled, if
- /// present.
- /// 3) The pages must be contiguous.
- ///
- /// This API is not intended for general use, clients should use
- /// MemoryBuffer::getFile instead.
- static const char *MapInFilePages(int FD, uint64_t FileSize);
-
- /// UnMapFilePages - Free pages mapped into the current process by
- /// MapInFilePages.
- ///
- /// This API is not intended for general use, clients should use
- /// MemoryBuffer::getFile instead.
- static void UnMapFilePages(const char *Base, uint64_t FileSize);
-
- /// @}
- /// @name Data
- /// @{
- protected:
- // Our win32 implementation relies on this string being mutable.
- mutable std::string path; ///< Storage for the path name.
-
-
- /// @}
- };
-
- /// This class is identical to Path class except it allows you to obtain the
- /// file status of the Path as well. The reason for the distinction is one of
- /// efficiency. First, the file status requires additional space and the space
- /// is incorporated directly into PathWithStatus without an additional malloc.
- /// Second, obtaining status information is an expensive operation on most
- /// operating systems so we want to be careful and explicity about where we
- /// allow this operation in LLVM.
- /// @brief Path with file status class.
- class PathWithStatus : public Path {
- /// @name Constructors
- /// @{
- public:
- /// @brief Default constructor
- PathWithStatus() : Path(), status(), fsIsValid(false) {}
-
- /// @brief Copy constructor
- PathWithStatus(const PathWithStatus &that)
- : Path(static_cast<const Path&>(that)), status(that.status),
- fsIsValid(that.fsIsValid) {}
-
- /// This constructor allows construction from a Path object
- /// @brief Path constructor
- PathWithStatus(const Path &other)
- : Path(other), status(), fsIsValid(false) {}
-
- /// This constructor will accept a char* or std::string as a path. No
- /// checking is done on this path to determine if it is valid. To
- /// determine validity of the path, use the isValid method.
- /// @brief Construct a Path from a string.
- explicit PathWithStatus(
- StringRef p ///< The path to assign.
- ) : Path(p), status(), fsIsValid(false) {}
-
- /// This constructor will accept a character range as a path. No checking
- /// is done on this path to determine if it is valid. To determine
- /// validity of the path, use the isValid method.
- /// @brief Construct a Path from a string.
- explicit PathWithStatus(
- const char *StrStart, ///< Pointer to the first character of the path
- unsigned StrLen ///< Length of the path.
- ) : Path(StrStart, StrLen), status(), fsIsValid(false) {}
-
- /// Makes a copy of \p that to \p this.
- /// @returns \p this
- /// @brief Assignment Operator
- PathWithStatus &operator=(const PathWithStatus &that) {
- static_cast<Path&>(*this) = static_cast<const Path&>(that);
- status = that.status;
- fsIsValid = that.fsIsValid;
- return *this;
- }
-
- /// Makes a copy of \p that to \p this.
- /// @returns \p this
- /// @brief Assignment Operator
- PathWithStatus &operator=(const Path &that) {
- static_cast<Path&>(*this) = static_cast<const Path&>(that);
- fsIsValid = false;
- return *this;
- }
-
- /// @}
- /// @name Methods
- /// @{
- public:
- /// This function returns status information about the file. The type of
- /// path (file or directory) is updated to reflect the actual contents
- /// of the file system.
- /// @returns 0 on failure, with Error explaining why (if non-zero)
- /// @returns a pointer to a FileStatus structure on success.
- /// @brief Get file status.
- const FileStatus *getFileStatus(
- bool forceUpdate = false, ///< Force an update from the file system
- std::string *Error = 0 ///< Optional place to return an error msg.
- ) const;
-
- /// @}
- /// @name Data
- /// @{
- private:
- mutable FileStatus status; ///< Status information.
- mutable bool fsIsValid; ///< Whether we've obtained it or not
-
- /// @}
- };
-
- /// This enumeration delineates the kinds of files that LLVM knows about.
- enum LLVMFileType {
- Unknown_FileType = 0, ///< Unrecognized file
- Bitcode_FileType, ///< Bitcode file
- Archive_FileType, ///< ar style archive file
- ELF_Relocatable_FileType, ///< ELF Relocatable object file
- ELF_Executable_FileType, ///< ELF Executable image
- ELF_SharedObject_FileType, ///< ELF dynamically linked shared lib
- ELF_Core_FileType, ///< ELF core image
- Mach_O_Object_FileType, ///< Mach-O Object file
- Mach_O_Executable_FileType, ///< Mach-O Executable
- Mach_O_FixedVirtualMemorySharedLib_FileType, ///< Mach-O Shared Lib, FVM
- Mach_O_Core_FileType, ///< Mach-O Core File
- Mach_O_PreloadExectuable_FileType, ///< Mach-O Preloaded Executable
- Mach_O_DynamicallyLinkedSharedLib_FileType, ///< Mach-O dynlinked shared lib
- Mach_O_DynamicLinker_FileType, ///< The Mach-O dynamic linker
- Mach_O_Bundle_FileType, ///< Mach-O Bundle file
- Mach_O_DynamicallyLinkedSharedLibStub_FileType, ///< Mach-O Shared lib stub
- COFF_FileType ///< COFF object file or lib
- };
-
- /// This utility function allows any memory block to be examined in order
- /// to determine its file type.
- LLVMFileType IdentifyFileType(const char*magic, unsigned length);
-
- /// This function can be used to copy the file specified by Src to the
- /// file specified by Dest. If an error occurs, Dest is removed.
- /// @returns true if an error occurs, false otherwise
- /// @brief Copy one file to another.
- bool CopyFile(const Path& Dest, const Path& Src, std::string* ErrMsg);
-
- /// This is the OS-specific path separator: a colon on Unix or a semicolon
- /// on Windows.
- extern const char PathSeparator;
-}
-
-}
-
-#endif
diff --git a/include/llvm/System/Process.h b/include/llvm/System/Process.h
deleted file mode 100644
index 41bcd69..0000000
--- a/include/llvm/System/Process.h
+++ /dev/null
@@ -1,146 +0,0 @@
-//===- llvm/System/Process.h ------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the llvm::sys::Process class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_PROCESS_H
-#define LLVM_SYSTEM_PROCESS_H
-
-#include "llvm/System/TimeValue.h"
-
-namespace llvm {
-namespace sys {
-
- /// This class provides an abstraction for getting information about the
- /// currently executing process.
- /// @since 1.4
- /// @brief An abstraction for operating system processes.
- class Process {
- /// @name Accessors
- /// @{
- public:
- /// This static function will return the operating system's virtual memory
- /// page size.
- /// @returns The number of bytes in a virtual memory page.
- /// @brief Get the virtual memory page size
- static unsigned GetPageSize();
-
- /// This static function will return the total amount of memory allocated
- /// by the process. This only counts the memory allocated via the malloc,
- /// calloc and realloc functions and includes any "free" holes in the
- /// allocated space.
- /// @brief Return process memory usage.
- static size_t GetMallocUsage();
-
- /// This static function will return the total memory usage of the
- /// process. This includes code, data, stack and mapped pages usage. Notei
- /// that the value returned here is not necessarily the Running Set Size,
- /// it is the total virtual memory usage, regardless of mapped state of
- /// that memory.
- static size_t GetTotalMemoryUsage();
-
- /// This static function will set \p user_time to the amount of CPU time
- /// spent in user (non-kernel) mode and \p sys_time to the amount of CPU
- /// time spent in system (kernel) mode. If the operating system does not
- /// support collection of these metrics, a zero TimeValue will be for both
- /// values.
- static void GetTimeUsage(
- TimeValue& elapsed,
- ///< Returns the TimeValue::now() giving current time
- TimeValue& user_time,
- ///< Returns the current amount of user time for the process
- TimeValue& sys_time
- ///< Returns the current amount of system time for the process
- );
-
- /// This static function will return the process' current user id number.
- /// Not all operating systems support this feature. Where it is not
- /// supported, the function should return 65536 as the value.
- static int GetCurrentUserId();
-
- /// This static function will return the process' current group id number.
- /// Not all operating systems support this feature. Where it is not
- /// supported, the function should return 65536 as the value.
- static int GetCurrentGroupId();
-
- /// This function makes the necessary calls to the operating system to
- /// prevent core files or any other kind of large memory dumps that can
- /// occur when a program fails.
- /// @brief Prevent core file generation.
- static void PreventCoreFiles();
-
- /// This function determines if the standard input is connected directly
- /// to a user's input (keyboard probably), rather than coming from a file
- /// or pipe.
- static bool StandardInIsUserInput();
-
- /// This function determines if the standard output is connected to a
- /// "tty" or "console" window. That is, the output would be displayed to
- /// the user rather than being put on a pipe or stored in a file.
- static bool StandardOutIsDisplayed();
-
- /// This function determines if the standard error is connected to a
- /// "tty" or "console" window. That is, the output would be displayed to
- /// the user rather than being put on a pipe or stored in a file.
- static bool StandardErrIsDisplayed();
-
- /// This function determines if the given file descriptor is connected to
- /// a "tty" or "console" window. That is, the output would be displayed to
- /// the user rather than being put on a pipe or stored in a file.
- static bool FileDescriptorIsDisplayed(int fd);
-
- /// This function determines the number of columns in the window
- /// if standard output is connected to a "tty" or "console"
- /// window. If standard output is not connected to a tty or
- /// console, or if the number of columns cannot be determined,
- /// this routine returns zero.
- static unsigned StandardOutColumns();
-
- /// This function determines the number of columns in the window
- /// if standard error is connected to a "tty" or "console"
- /// window. If standard error is not connected to a tty or
- /// console, or if the number of columns cannot be determined,
- /// this routine returns zero.
- static unsigned StandardErrColumns();
-
- /// This function determines whether the terminal connected to standard
- /// output supports colors. If standard output is not connected to a
- /// terminal, this function returns false.
- static bool StandardOutHasColors();
-
- /// This function determines whether the terminal connected to standard
- /// error supports colors. If standard error is not connected to a
- /// terminal, this function returns false.
- static bool StandardErrHasColors();
-
- /// Whether changing colors requires the output to be flushed.
- /// This is needed on systems that don't support escape sequences for
- /// changing colors.
- static bool ColorNeedsFlush();
-
- /// This function returns the colorcode escape sequences.
- /// If ColorNeedsFlush() is true then this function will change the colors
- /// and return an empty escape sequence. In that case it is the
- /// responsibility of the client to flush the output stream prior to
- /// calling this function.
- static const char *OutputColor(char c, bool bold, bool bg);
-
- /// Same as OutputColor, but only enables the bold attribute.
- static const char *OutputBold(bool bg);
-
- /// Resets the terminals colors, or returns an escape sequence to do so.
- static const char *ResetColor();
- /// @}
- };
-}
-}
-
-#endif
diff --git a/include/llvm/System/Program.h b/include/llvm/System/Program.h
deleted file mode 100644
index c595082..0000000
--- a/include/llvm/System/Program.h
+++ /dev/null
@@ -1,157 +0,0 @@
-//===- llvm/System/Program.h ------------------------------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the llvm::sys::Program class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_PROGRAM_H
-#define LLVM_SYSTEM_PROGRAM_H
-
-#include "llvm/System/Path.h"
-
-namespace llvm {
-namespace sys {
-
- // TODO: Add operations to communicate with the process, redirect its I/O,
- // etc.
-
- /// This class provides an abstraction for programs that are executable by the
- /// operating system. It provides a platform generic way to find executable
- /// programs from the path and to execute them in various ways. The sys::Path
- /// class is used to specify the location of the Program.
- /// @since 1.4
- /// @brief An abstraction for finding and executing programs.
- class Program {
- /// Opaque handle for target specific data.
- void *Data_;
-
- // Noncopyable.
- Program(const Program& other);
- Program& operator=(const Program& other);
-
- /// @name Methods
- /// @{
- public:
-
- Program();
- ~Program();
-
- /// Return process ID of this program.
- unsigned GetPid() const;
-
- /// This function executes the program using the \p arguments provided. The
- /// invoked program will inherit the stdin, stdout, and stderr file
- /// descriptors, the environment and other configuration settings of the
- /// invoking program. If Path::executable() does not return true when this
- /// function is called then a std::string is thrown.
- /// @returns false in case of error, true otherwise.
- /// @see FindProgramByName
- /// @brief Executes the program with the given set of \p args.
- bool Execute
- ( const Path& path, ///< sys::Path object providing the path of the
- ///< program to be executed. It is presumed this is the result of
- ///< the FindProgramByName method.
- const char** args, ///< A vector of strings that are passed to the
- ///< program. The first element should be the name of the program.
- ///< The list *must* be terminated by a null char* entry.
- const char ** env = 0, ///< An optional vector of strings to use for
- ///< the program's environment. If not provided, the current program's
- ///< environment will be used.
- const sys::Path** redirects = 0, ///< An optional array of pointers to
- ///< Paths. If the array is null, no redirection is done. The array
- ///< should have a size of at least three. If the pointer in the array
- ///< are not null, then the inferior process's stdin(0), stdout(1),
- ///< and stderr(2) will be redirected to the corresponding Paths.
- ///< When an empty Path is passed in, the corresponding file
- ///< descriptor will be disconnected (ie, /dev/null'd) in a portable
- ///< way.
- unsigned memoryLimit = 0, ///< If non-zero, this specifies max. amount
- ///< of memory can be allocated by process. If memory usage will be
- ///< higher limit, the child is killed and this call returns. If zero
- ///< - no memory limit.
- std::string* ErrMsg = 0 ///< If non-zero, provides a pointer to a string
- ///< instance in which error messages will be returned. If the string
- ///< is non-empty upon return an error occurred while invoking the
- ///< program.
- );
-
- /// This function waits for the program to exit. This function will block
- /// the current program until the invoked program exits.
- /// @returns an integer result code indicating the status of the program.
- /// A zero or positive value indicates the result code of the program. A
- /// negative value is the signal number on which it terminated.
- /// @see Execute
- /// @brief Waits for the program to exit.
- int Wait
- ( const Path& path, ///< The path to the child process executable.
- unsigned secondsToWait, ///< If non-zero, this specifies the amount
- ///< of time to wait for the child process to exit. If the time
- ///< expires, the child is killed and this call returns. If zero,
- ///< this function will wait until the child finishes or forever if
- ///< it doesn't.
- std::string* ErrMsg ///< If non-zero, provides a pointer to a string
- ///< instance in which error messages will be returned. If the string
- ///< is non-empty upon return an error occurred while waiting.
- );
-
- /// This function terminates the program.
- /// @returns true if an error occured.
- /// @see Execute
- /// @brief Terminates the program.
- bool Kill
- ( std::string* ErrMsg = 0 ///< If non-zero, provides a pointer to a string
- ///< instance in which error messages will be returned. If the string
- ///< is non-empty upon return an error occurred while killing the
- ///< program.
- );
-
- /// This static constructor (factory) will attempt to locate a program in
- /// the operating system's file system using some pre-determined set of
- /// locations to search (e.g. the PATH on Unix). Paths with slashes are
- /// returned unmodified.
- /// @returns A Path object initialized to the path of the program or a
- /// Path object that is empty (invalid) if the program could not be found.
- /// @brief Construct a Program by finding it by name.
- static Path FindProgramByName(const std::string& name);
-
- // These methods change the specified standard stream (stdin,
- // stdout, or stderr) to binary mode. They return true if an error
- // occurred
- static bool ChangeStdinToBinary();
- static bool ChangeStdoutToBinary();
- static bool ChangeStderrToBinary();
-
- /// A convenience function equivalent to Program prg; prg.Execute(..);
- /// prg.Wait(..);
- /// @see Execute, Wait
- static int ExecuteAndWait(const Path& path,
- const char** args,
- const char ** env = 0,
- const sys::Path** redirects = 0,
- unsigned secondsToWait = 0,
- unsigned memoryLimit = 0,
- std::string* ErrMsg = 0);
-
- /// A convenience function equivalent to Program prg; prg.Execute(..);
- /// @see Execute
- static void ExecuteNoWait(const Path& path,
- const char** args,
- const char ** env = 0,
- const sys::Path** redirects = 0,
- unsigned memoryLimit = 0,
- std::string* ErrMsg = 0);
-
- /// @}
-
- };
-}
-}
-
-#endif
diff --git a/include/llvm/System/RWMutex.h b/include/llvm/System/RWMutex.h
deleted file mode 100644
index 3a28818..0000000
--- a/include/llvm/System/RWMutex.h
+++ /dev/null
@@ -1,173 +0,0 @@
-//===- RWMutex.h - Reader/Writer Mutual Exclusion Lock ----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the llvm::sys::RWMutex class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_RWMUTEX_H
-#define LLVM_SYSTEM_RWMUTEX_H
-
-#include "llvm/System/Threading.h"
-#include <cassert>
-
-namespace llvm
-{
- namespace sys
- {
- /// @brief Platform agnostic RWMutex class.
- class RWMutexImpl
- {
- /// @name Constructors
- /// @{
- public:
-
- /// Initializes the lock but doesn't acquire it.
- /// @brief Default Constructor.
- explicit RWMutexImpl();
-
- /// Releases and removes the lock
- /// @brief Destructor
- ~RWMutexImpl();
-
- /// @}
- /// @name Methods
- /// @{
- public:
-
- /// Attempts to unconditionally acquire the lock in reader mode. If the
- /// lock is held by a writer, this method will wait until it can acquire
- /// the lock.
- /// @returns false if any kind of error occurs, true otherwise.
- /// @brief Unconditionally acquire the lock in reader mode.
- bool reader_acquire();
-
- /// Attempts to release the lock in reader mode.
- /// @returns false if any kind of error occurs, true otherwise.
- /// @brief Unconditionally release the lock in reader mode.
- bool reader_release();
-
- /// Attempts to unconditionally acquire the lock in reader mode. If the
- /// lock is held by any readers, this method will wait until it can
- /// acquire the lock.
- /// @returns false if any kind of error occurs, true otherwise.
- /// @brief Unconditionally acquire the lock in writer mode.
- bool writer_acquire();
-
- /// Attempts to release the lock in writer mode.
- /// @returns false if any kind of error occurs, true otherwise.
- /// @brief Unconditionally release the lock in write mode.
- bool writer_release();
-
- //@}
- /// @name Platform Dependent Data
- /// @{
- private:
- void* data_; ///< We don't know what the data will be
-
- /// @}
- /// @name Do Not Implement
- /// @{
- private:
- RWMutexImpl(const RWMutexImpl & original);
- void operator=(const RWMutexImpl &);
- /// @}
- };
-
- /// SmartMutex - An R/W mutex with a compile time constant parameter that
- /// indicates whether this mutex should become a no-op when we're not
- /// running in multithreaded mode.
- template<bool mt_only>
- class SmartRWMutex : public RWMutexImpl {
- unsigned readers, writers;
- public:
- explicit SmartRWMutex() : RWMutexImpl(), readers(0), writers(0) { }
-
- bool reader_acquire() {
- if (!mt_only || llvm_is_multithreaded())
- return RWMutexImpl::reader_acquire();
-
- // Single-threaded debugging code. This would be racy in multithreaded
- // mode, but provides not sanity checks in single threaded mode.
- ++readers;
- return true;
- }
-
- bool reader_release() {
- if (!mt_only || llvm_is_multithreaded())
- return RWMutexImpl::reader_release();
-
- // Single-threaded debugging code. This would be racy in multithreaded
- // mode, but provides not sanity checks in single threaded mode.
- assert(readers > 0 && "Reader lock not acquired before release!");
- --readers;
- return true;
- }
-
- bool writer_acquire() {
- if (!mt_only || llvm_is_multithreaded())
- return RWMutexImpl::writer_acquire();
-
- // Single-threaded debugging code. This would be racy in multithreaded
- // mode, but provides not sanity checks in single threaded mode.
- assert(writers == 0 && "Writer lock already acquired!");
- ++writers;
- return true;
- }
-
- bool writer_release() {
- if (!mt_only || llvm_is_multithreaded())
- return RWMutexImpl::writer_release();
-
- // Single-threaded debugging code. This would be racy in multithreaded
- // mode, but provides not sanity checks in single threaded mode.
- assert(writers == 1 && "Writer lock not acquired before release!");
- --writers;
- return true;
- }
-
- private:
- SmartRWMutex(const SmartRWMutex<mt_only> & original);
- void operator=(const SmartRWMutex<mt_only> &);
- };
- typedef SmartRWMutex<false> RWMutex;
-
- /// ScopedReader - RAII acquisition of a reader lock
- template<bool mt_only>
- struct SmartScopedReader {
- SmartRWMutex<mt_only>& mutex;
-
- explicit SmartScopedReader(SmartRWMutex<mt_only>& m) : mutex(m) {
- mutex.reader_acquire();
- }
-
- ~SmartScopedReader() {
- mutex.reader_release();
- }
- };
- typedef SmartScopedReader<false> ScopedReader;
-
- /// ScopedWriter - RAII acquisition of a writer lock
- template<bool mt_only>
- struct SmartScopedWriter {
- SmartRWMutex<mt_only>& mutex;
-
- explicit SmartScopedWriter(SmartRWMutex<mt_only>& m) : mutex(m) {
- mutex.writer_acquire();
- }
-
- ~SmartScopedWriter() {
- mutex.writer_release();
- }
- };
- typedef SmartScopedWriter<false> ScopedWriter;
- }
-}
-
-#endif
diff --git a/include/llvm/System/Signals.h b/include/llvm/System/Signals.h
deleted file mode 100644
index 7f1c87c..0000000
--- a/include/llvm/System/Signals.h
+++ /dev/null
@@ -1,59 +0,0 @@
-//===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file defines some helpful functions for dealing with the possibility of
-// unix signals occuring while your program is running.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_SIGNALS_H
-#define LLVM_SYSTEM_SIGNALS_H
-
-#include "llvm/System/Path.h"
-
-namespace llvm {
-namespace sys {
-
- /// This function runs all the registered interrupt handlers, including the
- /// removal of files registered by RemoveFileOnSignal.
- void RunInterruptHandlers();
-
- /// This function registers signal handlers to ensure that if a signal gets
- /// delivered that the named file is removed.
- /// @brief Remove a file if a fatal signal occurs.
- bool RemoveFileOnSignal(const Path &Filename, std::string* ErrMsg = 0);
-
- /// This function removes a file from the list of files to be removed on
- /// signal delivery.
- void DontRemoveFileOnSignal(const Path &Filename);
-
- /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
- /// process, print a stack trace and then exit.
- /// @brief Print a stack trace if a fatal signal occurs.
- void PrintStackTraceOnErrorSignal();
-
- /// AddSignalHandler - Add a function to be called when an abort/kill signal
- /// is delivered to the process. The handler can have a cookie passed to it
- /// to identify what instance of the handler it is.
- void AddSignalHandler(void (*FnPtr)(void *), void *Cookie);
-
- /// This function registers a function to be called when the user "interrupts"
- /// the program (typically by pressing ctrl-c). When the user interrupts the
- /// program, the specified interrupt function is called instead of the program
- /// being killed, and the interrupt function automatically disabled. Note
- /// that interrupt functions are not allowed to call any non-reentrant
- /// functions. An null interrupt function pointer disables the current
- /// installed function. Note also that the handler may be executed on a
- /// different thread on some platforms.
- /// @brief Register a function to be called when ctrl-c is pressed.
- void SetInterruptFunction(void (*IF)());
-} // End sys namespace
-} // End llvm namespace
-
-#endif
diff --git a/include/llvm/System/Solaris.h b/include/llvm/System/Solaris.h
deleted file mode 100644
index 15adb74..0000000
--- a/include/llvm/System/Solaris.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*===- llvm/System/Solaris.h ------------------------------------*- C++ -*-===*
- *
- * The LLVM Compiler Infrastructure
- *
- * This file is distributed under the University of Illinois Open Source
- * License. See LICENSE.TXT for details.
- *
- *===----------------------------------------------------------------------===*
- *
- * This file contains portability fixes for Solaris hosts.
- *
- *===----------------------------------------------------------------------===*/
-
-#ifndef LLVM_SYSTEM_SOLARIS_H
-#define LLVM_SYSTEM_SOLARIS_H
-
-#include <sys/types.h>
-#include <sys/regset.h>
-
-#undef CS
-#undef DS
-#undef ES
-#undef FS
-#undef GS
-#undef SS
-#undef EAX
-#undef ECX
-#undef EDX
-#undef EBX
-#undef ESP
-#undef EBP
-#undef ESI
-#undef EDI
-#undef EIP
-#undef UESP
-#undef EFL
-#undef ERR
-#undef TRAPNO
-
-#endif
diff --git a/include/llvm/System/SwapByteOrder.h b/include/llvm/System/SwapByteOrder.h
deleted file mode 100644
index 64a8acb..0000000
--- a/include/llvm/System/SwapByteOrder.h
+++ /dev/null
@@ -1,101 +0,0 @@
-//===- SwapByteOrder.h - Generic and optimized byte swaps -------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares generic and optimized functions to swap the byte order of
-// an integral type.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_SWAP_BYTE_ORDER_H
-#define LLVM_SYSTEM_SWAP_BYTE_ORDER_H
-
-#include "llvm/Support/type_traits.h"
-#include "llvm/System/DataTypes.h"
-#include <cstddef>
-#include <limits>
-
-namespace llvm {
-namespace sys {
-
-template<typename value_type>
-inline
-typename enable_if_c<sizeof(value_type) == 1
- && std::numeric_limits<value_type>::is_integer,
- value_type>::type
-SwapByteOrder(value_type Value) {
- // No swapping needed.
- return Value;
-}
-
-template<typename value_type>
-inline
-typename enable_if_c<sizeof(value_type) == 2
- && std::numeric_limits<value_type>::is_integer,
- value_type>::type
-SwapByteOrder(value_type Value) {
- // Cast signed types to unsigned before swapping.
- uint16_t value = static_cast<uint16_t>(Value);
-#if defined(_MSC_VER) && !defined(_DEBUG)
- // The DLL version of the runtime lacks these functions (bug!?), but in a
- // release build they're replaced with BSWAP instructions anyway.
- return _byteswap_ushort(value);
-#else
- uint16_t Hi = value << 8;
- uint16_t Lo = value >> 8;
- return value_type(Hi | Lo);
-#endif
-}
-
-template<typename value_type>
-inline
-typename enable_if_c<sizeof(value_type) == 4
- && std::numeric_limits<value_type>::is_integer,
- value_type>::type
-SwapByteOrder(value_type Value) {
- // Cast signed types to unsigned before swapping.
- uint32_t value = static_cast<uint32_t>(Value);
-#if defined(__llvm__) || \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && !defined(__ICC)
- return __builtin_bswap32(value);
-#elif defined(_MSC_VER) && !defined(_DEBUG)
- return _byteswap_ulong(value);
-#else
- uint32_t Byte0 = value & 0x000000FF;
- uint32_t Byte1 = value & 0x0000FF00;
- uint32_t Byte2 = value & 0x00FF0000;
- uint32_t Byte3 = value & 0xFF000000;
- return value_type(
- (Byte0 << 24) | (Byte1 << 8) | (Byte2 >> 8) | (Byte3 >> 24));
-#endif
-}
-
-template<typename value_type>
-inline
-typename enable_if_c<sizeof(value_type) == 8
- && std::numeric_limits<value_type>::is_integer,
- value_type>::type
-SwapByteOrder(value_type Value) {
- // Cast signed types to unsigned before swapping.
- uint64_t value = static_cast<uint64_t>(Value);
-#if defined(__llvm__) || \
- (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 3)) && !defined(__ICC)
- return __builtin_bswap64(value);
-#elif defined(_MSC_VER) && !defined(_DEBUG)
- return _byteswap_uint64(value);
-#else
- uint64_t Hi = SwapByteOrder<uint32_t>(uint32_t(value));
- uint32_t Lo = SwapByteOrder<uint32_t>(uint32_t(value >> 32));
- return value_type((Hi << 32) | Lo);
-#endif
-}
-
-} // end namespace sys
-} // end namespace llvm
-
-#endif
diff --git a/include/llvm/System/ThreadLocal.h b/include/llvm/System/ThreadLocal.h
deleted file mode 100644
index e6edd79..0000000
--- a/include/llvm/System/ThreadLocal.h
+++ /dev/null
@@ -1,54 +0,0 @@
-//===- llvm/System/ThreadLocal.h - Thread Local Data ------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This file declares the llvm::sys::ThreadLocal class.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_THREAD_LOCAL_H
-#define LLVM_SYSTEM_THREAD_LOCAL_H
-
-#include "llvm/System/Threading.h"
-#include <cassert>
-
-namespace llvm {
- namespace sys {
- // ThreadLocalImpl - Common base class of all ThreadLocal instantiations.
- // YOU SHOULD NEVER USE THIS DIRECTLY.
- class ThreadLocalImpl {
- void* data;
- public:
- ThreadLocalImpl();
- virtual ~ThreadLocalImpl();
- void setInstance(const void* d);
- const void* getInstance();
- void removeInstance();
- };
-
- /// ThreadLocal - A class used to abstract thread-local storage. It holds,
- /// for each thread, a pointer a single object of type T.
- template<class T>
- class ThreadLocal : public ThreadLocalImpl {
- public:
- ThreadLocal() : ThreadLocalImpl() { }
-
- /// get - Fetches a pointer to the object associated with the current
- /// thread. If no object has yet been associated, it returns NULL;
- T* get() { return static_cast<T*>(getInstance()); }
-
- // set - Associates a pointer to an object with the current thread.
- void set(T* d) { setInstance(d); }
-
- // erase - Removes the pointer associated with the current thread.
- void erase() { removeInstance(); }
- };
- }
-}
-
-#endif
diff --git a/include/llvm/System/Threading.h b/include/llvm/System/Threading.h
deleted file mode 100644
index 1d0ed1e..0000000
--- a/include/llvm/System/Threading.h
+++ /dev/null
@@ -1,59 +0,0 @@
-//===-- llvm/System/Threading.h - Control multithreading mode --*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// TThis file defines llvm_start_multithreaded() and friends.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_THREADING_H
-#define LLVM_SYSTEM_THREADING_H
-
-namespace llvm {
- /// llvm_start_multithreaded - Allocate and initialize structures needed to
- /// make LLVM safe for multithreading. The return value indicates whether
- /// multithreaded initialization succeeded. LLVM will still be operational
- /// on "failed" return, and will still be safe for hosting threading
- /// applications in the JIT, but will not be safe for concurrent calls to the
- /// LLVM APIs.
- /// THIS MUST EXECUTE IN ISOLATION FROM ALL OTHER LLVM API CALLS.
- bool llvm_start_multithreaded();
-
- /// llvm_stop_multithreaded - Deallocate structures necessary to make LLVM
- /// safe for multithreading.
- /// THIS MUST EXECUTE IN ISOLATION FROM ALL OTHER LLVM API CALLS.
- void llvm_stop_multithreaded();
-
- /// llvm_is_multithreaded - Check whether LLVM is executing in thread-safe
- /// mode or not.
- bool llvm_is_multithreaded();
-
- /// acquire_global_lock - Acquire the global lock. This is a no-op if called
- /// before llvm_start_multithreaded().
- void llvm_acquire_global_lock();
-
- /// release_global_lock - Release the global lock. This is a no-op if called
- /// before llvm_start_multithreaded().
- void llvm_release_global_lock();
-
- /// llvm_execute_on_thread - Execute the given \arg UserFn on a separate
- /// thread, passing it the provided \arg UserData.
- ///
- /// This function does not guarantee that the code will actually be executed
- /// on a separate thread or honoring the requested stack size, but tries to do
- /// so where system support is available.
- ///
- /// \param UserFn - The callback to execute.
- /// \param UserData - An argument to pass to the callback function.
- /// \param RequestedStackSize - If non-zero, a requested size (in bytes) for
- /// the thread stack.
- void llvm_execute_on_thread(void (*UserFn)(void*), void *UserData,
- unsigned RequestedStackSize = 0);
-}
-
-#endif
diff --git a/include/llvm/System/TimeValue.h b/include/llvm/System/TimeValue.h
deleted file mode 100644
index b82647f..0000000
--- a/include/llvm/System/TimeValue.h
+++ /dev/null
@@ -1,382 +0,0 @@
-//===-- TimeValue.h - Declare OS TimeValue Concept --------------*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// This header file declares the operating system TimeValue concept.
-//
-//===----------------------------------------------------------------------===//
-
-#include "llvm/System/DataTypes.h"
-#include <string>
-
-#ifndef LLVM_SYSTEM_TIMEVALUE_H
-#define LLVM_SYSTEM_TIMEVALUE_H
-
-namespace llvm {
-namespace sys {
- /// This class is used where a precise fixed point in time is required. The
- /// range of TimeValue spans many hundreds of billions of years both past and
- /// present. The precision of TimeValue is to the nanosecond. However, the
- /// actual precision of its values will be determined by the resolution of
- /// the system clock. The TimeValue class is used in conjunction with several
- /// other lib/System interfaces to specify the time at which a call should
- /// timeout, etc.
- /// @since 1.4
- /// @brief Provides an abstraction for a fixed point in time.
- class TimeValue {
-
- /// @name Constants
- /// @{
- public:
-
- /// A constant TimeValue representing the smallest time
- /// value permissable by the class. MinTime is some point
- /// in the distant past, about 300 billion years BCE.
- /// @brief The smallest possible time value.
- static const TimeValue MinTime;
-
- /// A constant TimeValue representing the largest time
- /// value permissable by the class. MaxTime is some point
- /// in the distant future, about 300 billion years AD.
- /// @brief The largest possible time value.
- static const TimeValue MaxTime;
-
- /// A constant TimeValue representing the base time,
- /// or zero time of 00:00:00 (midnight) January 1st, 2000.
- /// @brief 00:00:00 Jan 1, 2000 UTC.
- static const TimeValue ZeroTime;
-
- /// A constant TimeValue for the Posix base time which is
- /// 00:00:00 (midnight) January 1st, 1970.
- /// @brief 00:00:00 Jan 1, 1970 UTC.
- static const TimeValue PosixZeroTime;
-
- /// A constant TimeValue for the Win32 base time which is
- /// 00:00:00 (midnight) January 1st, 1601.
- /// @brief 00:00:00 Jan 1, 1601 UTC.
- static const TimeValue Win32ZeroTime;
-
- /// @}
- /// @name Types
- /// @{
- public:
- typedef int64_t SecondsType; ///< Type used for representing seconds.
- typedef int32_t NanoSecondsType;///< Type used for representing nanoseconds.
-
- enum TimeConversions {
- NANOSECONDS_PER_SECOND = 1000000000, ///< One Billion
- MICROSECONDS_PER_SECOND = 1000000, ///< One Million
- MILLISECONDS_PER_SECOND = 1000, ///< One Thousand
- NANOSECONDS_PER_MICROSECOND = 1000, ///< One Thousand
- NANOSECONDS_PER_MILLISECOND = 1000000,///< One Million
- NANOSECONDS_PER_POSIX_TICK = 100, ///< Posix tick is 100 Hz (10ms)
- NANOSECONDS_PER_WIN32_TICK = 100 ///< Win32 tick is 100 Hz (10ms)
- };
-
- /// @}
- /// @name Constructors
- /// @{
- public:
- /// Caller provides the exact value in seconds and nanoseconds. The
- /// \p nanos argument defaults to zero for convenience.
- /// @brief Explicit constructor
- explicit TimeValue (SecondsType seconds, NanoSecondsType nanos = 0)
- : seconds_( seconds ), nanos_( nanos ) { this->normalize(); }
-
- /// Caller provides the exact value as a double in seconds with the
- /// fractional part representing nanoseconds.
- /// @brief Double Constructor.
- explicit TimeValue( double new_time )
- : seconds_( 0 ) , nanos_ ( 0 ) {
- SecondsType integer_part = static_cast<SecondsType>( new_time );
- seconds_ = integer_part;
- nanos_ = static_cast<NanoSecondsType>( (new_time -
- static_cast<double>(integer_part)) * NANOSECONDS_PER_SECOND );
- this->normalize();
- }
-
- /// This is a static constructor that returns a TimeValue that represents
- /// the current time.
- /// @brief Creates a TimeValue with the current time (UTC).
- static TimeValue now();
-
- /// @}
- /// @name Operators
- /// @{
- public:
- /// Add \p that to \p this.
- /// @returns this
- /// @brief Incrementing assignment operator.
- TimeValue& operator += (const TimeValue& that ) {
- this->seconds_ += that.seconds_ ;
- this->nanos_ += that.nanos_ ;
- this->normalize();
- return *this;
- }
-
- /// Subtract \p that from \p this.
- /// @returns this
- /// @brief Decrementing assignment operator.
- TimeValue& operator -= (const TimeValue &that ) {
- this->seconds_ -= that.seconds_ ;
- this->nanos_ -= that.nanos_ ;
- this->normalize();
- return *this;
- }
-
- /// Determine if \p this is less than \p that.
- /// @returns True iff *this < that.
- /// @brief True if this < that.
- int operator < (const TimeValue &that) const { return that > *this; }
-
- /// Determine if \p this is greather than \p that.
- /// @returns True iff *this > that.
- /// @brief True if this > that.
- int operator > (const TimeValue &that) const {
- if ( this->seconds_ > that.seconds_ ) {
- return 1;
- } else if ( this->seconds_ == that.seconds_ ) {
- if ( this->nanos_ > that.nanos_ ) return 1;
- }
- return 0;
- }
-
- /// Determine if \p this is less than or equal to \p that.
- /// @returns True iff *this <= that.
- /// @brief True if this <= that.
- int operator <= (const TimeValue &that) const { return that >= *this; }
-
- /// Determine if \p this is greater than or equal to \p that.
- /// @returns True iff *this >= that.
- /// @brief True if this >= that.
- int operator >= (const TimeValue &that) const {
- if ( this->seconds_ > that.seconds_ ) {
- return 1;
- } else if ( this->seconds_ == that.seconds_ ) {
- if ( this->nanos_ >= that.nanos_ ) return 1;
- }
- return 0;
- }
-
- /// Determines if two TimeValue objects represent the same moment in time.
- /// @brief True iff *this == that.
- /// @brief True if this == that.
- int operator == (const TimeValue &that) const {
- return (this->seconds_ == that.seconds_) &&
- (this->nanos_ == that.nanos_);
- }
-
- /// Determines if two TimeValue objects represent times that are not the
- /// same.
- /// @return True iff *this != that.
- /// @brief True if this != that.
- int operator != (const TimeValue &that) const { return !(*this == that); }
-
- /// Adds two TimeValue objects together.
- /// @returns The sum of the two operands as a new TimeValue
- /// @brief Addition operator.
- friend TimeValue operator + (const TimeValue &tv1, const TimeValue &tv2);
-
- /// Subtracts two TimeValue objects.
- /// @returns The difference of the two operands as a new TimeValue
- /// @brief Subtraction operator.
- friend TimeValue operator - (const TimeValue &tv1, const TimeValue &tv2);
-
- /// @}
- /// @name Accessors
- /// @{
- public:
-
- /// Returns only the seconds component of the TimeValue. The nanoseconds
- /// portion is ignored. No rounding is performed.
- /// @brief Retrieve the seconds component
- SecondsType seconds() const { return seconds_; }
-
- /// Returns only the nanoseconds component of the TimeValue. The seconds
- /// portion is ignored.
- /// @brief Retrieve the nanoseconds component.
- NanoSecondsType nanoseconds() const { return nanos_; }
-
- /// Returns only the fractional portion of the TimeValue rounded down to the
- /// nearest microsecond (divide by one thousand).
- /// @brief Retrieve the fractional part as microseconds;
- uint32_t microseconds() const {
- return nanos_ / NANOSECONDS_PER_MICROSECOND;
- }
-
- /// Returns only the fractional portion of the TimeValue rounded down to the
- /// nearest millisecond (divide by one million).
- /// @brief Retrieve the fractional part as milliseconds;
- uint32_t milliseconds() const {
- return nanos_ / NANOSECONDS_PER_MILLISECOND;
- }
-
- /// Returns the TimeValue as a number of microseconds. Note that the value
- /// returned can overflow because the range of a uint64_t is smaller than
- /// the range of a TimeValue. Nevertheless, this is useful on some operating
- /// systems and is therefore provided.
- /// @brief Convert to a number of microseconds (can overflow)
- uint64_t usec() const {
- return seconds_ * MICROSECONDS_PER_SECOND +
- ( nanos_ / NANOSECONDS_PER_MICROSECOND );
- }
-
- /// Returns the TimeValue as a number of milliseconds. Note that the value
- /// returned can overflow because the range of a uint64_t is smaller than
- /// the range of a TimeValue. Nevertheless, this is useful on some operating
- /// systems and is therefore provided.
- /// @brief Convert to a number of milliseconds (can overflow)
- uint64_t msec() const {
- return seconds_ * MILLISECONDS_PER_SECOND +
- ( nanos_ / NANOSECONDS_PER_MILLISECOND );
- }
-
- /// Converts the TimeValue into the corresponding number of "ticks" for
- /// Posix, correcting for the difference in Posix zero time.
- /// @brief Convert to unix time (100 nanoseconds since 12:00:00a Jan 1,1970)
- uint64_t toPosixTime() const {
- uint64_t result = seconds_ - PosixZeroTime.seconds_;
- result += nanos_ / NANOSECONDS_PER_POSIX_TICK;
- return result;
- }
-
- /// Converts the TimeValue into the corresponding number of seconds
- /// since the epoch (00:00:00 Jan 1,1970).
- uint64_t toEpochTime() const {
- return seconds_ - PosixZeroTime.seconds_;
- }
-
- /// Converts the TimeValue into the corresponding number of "ticks" for
- /// Win32 platforms, correcting for the difference in Win32 zero time.
- /// @brief Convert to windows time (seconds since 12:00:00a Jan 1, 1601)
- uint64_t toWin32Time() const {
- uint64_t result = seconds_ - Win32ZeroTime.seconds_;
- result += nanos_ / NANOSECONDS_PER_WIN32_TICK;
- return result;
- }
-
- /// Provides the seconds and nanoseconds as results in its arguments after
- /// correction for the Posix zero time.
- /// @brief Convert to timespec time (ala POSIX.1b)
- void getTimespecTime( uint64_t& seconds, uint32_t& nanos ) const {
- seconds = seconds_ - PosixZeroTime.seconds_;
- nanos = nanos_;
- }
-
- /// Provides conversion of the TimeValue into a readable time & date.
- /// @returns std::string containing the readable time value
- /// @brief Convert time to a string.
- std::string str() const;
-
- /// @}
- /// @name Mutators
- /// @{
- public:
- /// The seconds component of the TimeValue is set to \p sec without
- /// modifying the nanoseconds part. This is useful for whole second
- /// arithmetic.
- /// @brief Set the seconds component.
- void seconds (SecondsType sec ) {
- this->seconds_ = sec;
- this->normalize();
- }
-
- /// The nanoseconds component of the TimeValue is set to \p nanos without
- /// modifying the seconds part. This is useful for basic computations
- /// involving just the nanoseconds portion. Note that the TimeValue will be
- /// normalized after this call so that the fractional (nanoseconds) portion
- /// will have the smallest equivalent value.
- /// @brief Set the nanoseconds component using a number of nanoseconds.
- void nanoseconds ( NanoSecondsType nanos ) {
- this->nanos_ = nanos;
- this->normalize();
- }
-
- /// The seconds component remains unchanged.
- /// @brief Set the nanoseconds component using a number of microseconds.
- void microseconds ( int32_t micros ) {
- this->nanos_ = micros * NANOSECONDS_PER_MICROSECOND;
- this->normalize();
- }
-
- /// The seconds component remains unchanged.
- /// @brief Set the nanoseconds component using a number of milliseconds.
- void milliseconds ( int32_t millis ) {
- this->nanos_ = millis * NANOSECONDS_PER_MILLISECOND;
- this->normalize();
- }
-
- /// @brief Converts from microsecond format to TimeValue format
- void usec( int64_t microseconds ) {
- this->seconds_ = microseconds / MICROSECONDS_PER_SECOND;
- this->nanos_ = NanoSecondsType(microseconds % MICROSECONDS_PER_SECOND) *
- NANOSECONDS_PER_MICROSECOND;
- this->normalize();
- }
-
- /// @brief Converts from millisecond format to TimeValue format
- void msec( int64_t milliseconds ) {
- this->seconds_ = milliseconds / MILLISECONDS_PER_SECOND;
- this->nanos_ = NanoSecondsType(milliseconds % MILLISECONDS_PER_SECOND) *
- NANOSECONDS_PER_MILLISECOND;
- this->normalize();
- }
-
- /// Converts the \p seconds argument from PosixTime to the corresponding
- /// TimeValue and assigns that value to \p this.
- /// @brief Convert seconds form PosixTime to TimeValue
- void fromEpochTime( SecondsType seconds ) {
- seconds_ = seconds + PosixZeroTime.seconds_;
- nanos_ = 0;
- this->normalize();
- }
-
- /// Converts the \p win32Time argument from Windows FILETIME to the
- /// corresponding TimeValue and assigns that value to \p this.
- /// @brief Convert seconds form Windows FILETIME to TimeValue
- void fromWin32Time( uint64_t win32Time ) {
- this->seconds_ = win32Time / 10000000 + Win32ZeroTime.seconds_;
- this->nanos_ = NanoSecondsType(win32Time % 10000000) * 100;
- }
-
- /// @}
- /// @name Implementation
- /// @{
- private:
- /// This causes the values to be represented so that the fractional
- /// part is minimized, possibly incrementing the seconds part.
- /// @brief Normalize to canonical form.
- void normalize();
-
- /// @}
- /// @name Data
- /// @{
- private:
- /// Store the values as a <timeval>.
- SecondsType seconds_;///< Stores the seconds part of the TimeVal
- NanoSecondsType nanos_; ///< Stores the nanoseconds part of the TimeVal
- /// @}
-
- };
-
-inline TimeValue operator + (const TimeValue &tv1, const TimeValue &tv2) {
- TimeValue sum (tv1.seconds_ + tv2.seconds_, tv1.nanos_ + tv2.nanos_);
- sum.normalize ();
- return sum;
-}
-
-inline TimeValue operator - (const TimeValue &tv1, const TimeValue &tv2) {
- TimeValue difference (tv1.seconds_ - tv2.seconds_, tv1.nanos_ - tv2.nanos_ );
- difference.normalize ();
- return difference;
-}
-
-}
-}
-
-#endif
diff --git a/include/llvm/System/Valgrind.h b/include/llvm/System/Valgrind.h
deleted file mode 100644
index 5ec79c3..0000000
--- a/include/llvm/System/Valgrind.h
+++ /dev/null
@@ -1,32 +0,0 @@
-//===- llvm/System/Valgrind.h - Communication with Valgrind -----*- C++ -*-===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-//
-// Methods for communicating with a valgrind instance this program is running
-// under. These are all no-ops unless LLVM was configured on a system with the
-// valgrind headers installed and valgrind is controlling this process.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLVM_SYSTEM_VALGRIND_H
-#define LLVM_SYSTEM_VALGRIND_H
-
-#include <stddef.h>
-
-namespace llvm {
-namespace sys {
- // True if Valgrind is controlling this process.
- bool RunningOnValgrind();
-
- // Discard valgrind's translation of code in the range [Addr .. Addr + Len).
- // Otherwise valgrind may continue to execute the old version of the code.
- void ValgrindDiscardTranslations(const void *Addr, size_t Len);
-}
-}
-
-#endif