From d771c5340aa281c35d22e207b6321b52246639a2 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Mon, 16 Aug 2004 07:10:09 +0000 Subject: [PATCH] Back out include/llvm/System changes until a satisfactory solution can be determined. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15817 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/llvm/System/ErrorCode.h | 208 ------------------------------- include/llvm/System/Path.h | 214 -------------------------------- include/llvm/System/README.txt | 14 --- 3 files changed, 436 deletions(-) delete mode 100644 include/llvm/System/ErrorCode.h delete mode 100644 include/llvm/System/Path.h delete mode 100644 include/llvm/System/README.txt diff --git a/include/llvm/System/ErrorCode.h b/include/llvm/System/ErrorCode.h deleted file mode 100644 index 9672bd261d7..00000000000 --- a/include/llvm/System/ErrorCode.h +++ /dev/null @@ -1,208 +0,0 @@ -//===- ErrorCode.h - Declare ErrorCode class --------------------*- C++ -*-===// -// -// Copyright (C) 2004 eXtensible Systems, Inc. All Rights Reserved. -// -// This program is open source software; you can redistribute it and/or modify -// it under the terms of the University of Illinois Open Source License. See -// LICENSE.TXT (distributed with this software) for details. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -// or FITNESS FOR A PARTICULAR PURPOSE. -// -//===----------------------------------------------------------------------===// -/// @file lib/System/ErrorCode.h -/// @author Reid Spencer (original author) -/// @version \verbatim $Id$ \endverbatim -/// @date 2004/08/14 -/// @since 1.4 -/// @brief Declares the llvm::sys::ErrorCode class. -//===----------------------------------------------------------------------===// -#ifndef LLVM_SYSTEM_ERRORCODE_H -#define LLVM_SYSTEM_ERRORCODE_H - -#include - -/// @brief Computes an errorcode value from its domain and index values. -#define LLVM_ERROR_CODE( domain, index ) \ - ( ( domain << ::llvm::sys::ERROR_DOMAIN_SHIFT ) + \ - ( index & ::llvm::sys::ERROR_INDEX_MASK )) - -namespace llvm { -namespace sys { - - /// @brief The number of bits to shift right to get the domain part of an error code. - const uint32_t ERROR_DOMAIN_SHIFT = (sizeof(uint32_t)*8)*3/4; - - const uint32_t ERROR_DOMAIN_MASK = - ((1<<((sizeof(uint32_t)*8)-ERROR_DOMAIN_SHIFT))-1)<( code ) ) { } - - /// Copies one ErrorCode to another. - /// @brief Copy Constructor. - ErrorCode(const ErrorCode& that) throw() : Code ( that.Code ) { } - - /// Nothing much to do. - /// @brief Destructor - ~ErrorCode(void) throw() {} - - /// @} - /// @name Operators - /// @{ - public: - /// Assigns one ErrorCode object to another - /// @brief Assignment Operator. - ErrorCode & operator = (const ErrorCode& that) throw() { - Code = that.Code; - return *this; - } - - /// Returns true if \p this and \p that refer to the same type of error - /// @brief Equality Operator. - bool operator == (const ErrorCode& that) const throw() { - return Code == that.Code; - } - - /// Returns true if \p this and \p that do not refer to the same type of error - /// @brief Inequality Operator. - bool operator != (const ErrorCode& that) const throw() { - return Code != that.Code; - } - - /// @return a non zero value if an error condition exists - /// @brief Test Operator - operator bool() const throw() { return Code == NOT_AN_ERROR; } - - /// @return a non zero value if an error condition exists - /// @brief Test Operator. - operator int() const throw() { return Code; } - - /// @brief unsigned conversion operator. - operator unsigned int() const throw() { return Code; } - - /// @brief long conversion operator. - operator long() const throw() { return Code; } - - /// @brief unsigned long conversion operator - operator unsigned long() const throw() { return Code; } - - /// @} - /// @name Accessors - /// @{ - public: - /// @returns the integer error code value. - /// @brief Provides the integer error code value. - uint32_t code() const throw() { return Code; } - - /// @returns the integer domain number for the error number - /// @brief Provides the domain of the error - uint32_t domain() const throw() { - return (Code & ERROR_DOMAIN_MASK) >> ERROR_DOMAIN_SHIFT; - } - - /// @brief Provides the index of the error - uint32_t index() const throw() { - return Code & ERROR_INDEX_MASK; - } - - /// @brief Provides a readable string related to the error code - std::string description() const throw(); - - /// If \p this ErrorCode and \p ec have the same error code then return - /// true, otherwise false. - /// @param ec An errorcode value to compare against this ErrorCode - /// @returns true if \p this ErrorCode has the same error code as \p errcode - /// @brief Determines identity of the error code. - bool is( const ErrorCode& ec ) const throw() { return Code == ec.Code; } - - /// @} - /// @name Mutators - /// @{ - public: - /// @returns the previous integer error code value. - /// @brief allows the integer error code to be set. - uint32_t code(uint32_t code) throw() { - uint32_t old_code = Code; - Code = code; - return old_code; - } - - /// @} - /// @name Data - /// @{ - private: - uint32_t Code; ///< The error code value - /// @} - - }; - -} -} - -// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab - -#endif diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h deleted file mode 100644 index 305b303620b..00000000000 --- a/include/llvm/System/Path.h +++ /dev/null @@ -1,214 +0,0 @@ -//===- Path.h - Implement the Path class ------------------------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// Copyright (C) 2003 eXtensible Systems, Inc. All Rights Reserved. -// -// This program is open source software; you can redistribute it and/or modify -// it under the terms of the University of Illinois Open Source License. See -// LICENSE.TXT (distributed with this software) for details. -// -// This program is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY -// or FITNESS FOR A PARTICULAR PURPOSE. -// -//===----------------------------------------------------------------------===// -// -// This file declares the llvm::sys::Path class. The Path class provides the -// operating system agnostic concept of the name of a file or directory. -// -//===----------------------------------------------------------------------===// -/// @file lib/System/Path.h -/// @author Reid Spencer (original author) -/// @version \verbatim $Id$ \endverbatim -/// @date 2004/08/14 -/// @since 1.4 -/// @brief Declares the llvm::sys::Path class. -//===----------------------------------------------------------------------===// - -#ifndef LLVM_SYSTEM_PATH_H -#define LLVM_SYSTEM_PATH_H - -#include "llvm/System/ErrorCode.h" - -namespace llvm { -namespace sys { - - /// This class provides an abstraction for the name of a path - /// to a file or directory in the filesystem. - /// @since 1.4 - /// @brief An abstraction for operating system paths. - class Path : public std::string - { - /// @name Types - /// @{ - public: - /// @brief An enumerator for specifying special ways to construct - /// the path. - enum ConstructSpecial { - CONSTRUCT_TEMP_FILE = 1, ///< make a temporary file name - CONSTRUCT_TEMP_DIR = 2, ///< Make a temporary directory name - }; - - /// @} - /// @name Constructors - /// @{ - public: - /// Forward declare this because constructors need to use it. - /// @returns true if the path is valid - /// @brief Determines if the path is valid (properly formed) or not. - inline bool is_valid() const throw(); - - /// Creates a null (empty) path - /// @brief Default Constructor - Path () throw() {} - - /// Creates a path from char* - /// @brief char* converter - Path ( const char * name ) throw() : std::string(name) { - assert(is_valid()); - } - - /// @brief std::string converter - Path ( const std::string& name ) throw() : std::string(name) { - assert(is_valid()); - } - - /// Copies the path with copy-on-write semantics. The \p this Path - /// will reference \p the that Path until one of them is modified - /// at which point a full copy is taken before the write. - /// @brief Copy Constructor - Path ( const Path & that ) throw() : std::string(that) { - assert(is_valid()); - } - - /// This constructor will construct the path using a special - /// construction argument that will pre-fill the path with the name - /// of some special path name - /// @brief Construct a special, well known path - Path( ConstructSpecial ) throw(); - - /// Releases storage associated with the Path object - /// @brief Destructor - ~Path () throw() {} - - /// @} - /// @name Operators - /// @{ - public: - /// Makes a copy of \p that to \p this with copy-on-write semantics. - /// @returns \p this - /// @brief Assignment Operator - Path & operator = ( const Path & that ) throw() { - this->assign ( that ); - return *this; - } - - /// Comparies \p this Path with \p that Path for equality. - /// @returns true if \p this and \p that refer to the same item. - /// @brief Equality Operator - bool operator ==( const Path & that ) const throw() { - return 0 == this->compare( that ) ; - } - - /// Comparies \p this Path with \p that Path for inequality. - /// @returns true if \p this and \p that refer to different items. - /// @brief Inequality Operator - bool operator !=( const Path & that ) const throw() { - return 0 != this->compare( that ); - } - - /// @} - /// @name Accessors - /// @{ - public: - /// @returns true if the path could reference a file - /// @brief Determines if the path is valid for a file reference. - bool is_file() const throw(); - - /// @returns true if the path could reference a directory - /// @brief Determines if the path is valid for a directory reference. - bool is_directory() const throw(); - - /// @brief Fills and zero terminates a buffer with the path - inline void fill( char* buffer, uint32_t len ) const throw(); - - /// @} - /// @name Mutators - /// @{ - public: - /// This ensures that the pathname is terminated with a / - /// @brief Make the path reference a directory. - ErrorCode make_directory() throw(); - - /// This ensures that the pathname is not terminated with a / - /// @brief Makes the path reference a file. - ErrorCode make_file() throw(); - - /// the file system. - /// @returns true if the pathname references an existing file. - /// @brief Determines if the path is a file or directory in - ErrorCode exists() throw(); - - /// The \p dirname is added to the end of the Path. - /// @param dirname A string providing the directory name to - /// be appended to the path. - /// @brief Appends the name of a directory. - ErrorCode append_directory( const std::string & dirname ) throw(); - - /// The \p filename is added to the end of the Path. - /// @brief Appends the name of a file. - ErrorCode append_file( const std::string& filename ) throw(); - - /// Directories will have no entries. Files will be zero length. If - /// the file or directory already exists, no error results. - /// @throws SystemException if any error occurs. - /// @brief Causes the file or directory to exist in the filesystem. - ErrorCode create( bool create_parents = false ) throw(); - - ErrorCode create_directory() throw(); - ErrorCode create_directories() throw() ; - ErrorCode create_file() throw() ; - - /// Directories must be empty before they can be removed. If not, - /// an error will result. Files will be unlinked, even if another - /// process is using them. - /// @brief Removes the file or directory from the filesystem. - ErrorCode remove() throw(); - ErrorCode remove_directory() throw() ; - ErrorCode remove_file() throw() ; - - /// Temporary file names are a common need. This method uses the - /// template in the existing path and uniquifies a file name based - /// on the template. - ErrorCode make_temp_file() throw(); - - /// Temporary directory names are a common need. This method uses - /// the template in the existing path and uniqufies a directory - /// name based on the template. - ErrorCode make_temp_directory() throw(); - - /// Find library. - ErrorCode find_lib( const char * file ) throw(); - /// @} - - }; - - inline bool Path::is_valid() const throw() { - if ( empty() ) return false; - return true; - } - - inline void Path::fill( char* buffer, size_t bufflen ) const throw() { - size_t pathlen = length(); - assert( bufflen > pathlen ); - size_t copylen = pathlen copy(buffer, copylen, 0 ); - buffer[ copylen ] = 0; - } -} -} - -// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab - -#endif diff --git a/include/llvm/System/README.txt b/include/llvm/System/README.txt deleted file mode 100644 index 1c4860ea8af..00000000000 --- a/include/llvm/System/README.txt +++ /dev/null @@ -1,14 +0,0 @@ -System Utilities Interface -========================== - -The design of this library has several key constraints aimed at shielding LLVM -from the vagaries of operating system differences. The goal here is to provide -interfaces to operating system concepts (files, memory maps, sockets, signals, -locking, etc) efficiently and in such a way that the remainder of LLVM is -completely operating system agnostic. - -PLEASE READ AND COMPREHEND FULLY THE DOCUMENTATION in - -llvm/docs/SystemLibrary.html - -before making changes to this library. -- 2.34.1