summaryrefslogtreecommitdiff
path: root/lib/System
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-08-23 22:45:37 +0000
committerChris Lattner <sabre@nondot.org>2009-08-23 22:45:37 +0000
commit74382b7c699120fbec5cb5603c9cf4212eb37f06 (patch)
treec8c2c5b8879b256c428b0d35841b9cce1c2cc51c /lib/System
parent983c592272eb59d39fd78c515e1f2701638879e0 (diff)
downloadllvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.gz
llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.bz2
llvm-74382b7c699120fbec5cb5603c9cf4212eb37f06.tar.xz
Prune #includes from llvm/Linker.h and llvm/System/Path.h,
forcing them down into various .cpp files. This change also: 1. Renames TimeValue::toString() and Path::toString() to ::str() for similarity with the STL. 2. Removes all stream insertion support for sys::Path, forcing clients to call .str(). 3. Removes a use of Config/alloca.h from bugpoint, using smallvector instead. 4. Weans llvm-db off <iostream> sys::Path really needs to be gutted, but I don't have the desire to do it at this point. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@79869 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/System')
-rw-r--r--lib/System/Path.cpp9
-rw-r--r--lib/System/Unix/Path.inc14
-rw-r--r--lib/System/Unix/Program.inc4
-rw-r--r--lib/System/Unix/TimeValue.inc2
-rw-r--r--lib/System/Win32/Path.inc4
-rw-r--r--lib/System/Win32/Program.inc7
-rw-r--r--lib/System/Win32/TimeValue.inc2
7 files changed, 16 insertions, 26 deletions
diff --git a/lib/System/Path.cpp b/lib/System/Path.cpp
index ce4762e56d..df33574809 100644
--- a/lib/System/Path.cpp
+++ b/lib/System/Path.cpp
@@ -29,19 +29,10 @@ bool Path::operator==(const Path &that) const {
return path == that.path;
}
-bool Path::operator!=(const Path &that) const {
- return path != that.path;
-}
-
bool Path::operator<(const Path& that) const {
return path < that.path;
}
-std::ostream& llvm::operator<<(std::ostream &strm, const sys::Path &aPath) {
- strm << aPath.toString();
- return strm;
-}
-
Path
Path::GetLLVMConfigDir() {
Path result;
diff --git a/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index a54fcfd84b..7139f4eb9b 100644
--- a/lib/System/Unix/Path.inc
+++ b/lib/System/Unix/Path.inc
@@ -119,7 +119,7 @@ void Path::makeAbsolute() {
CWD.appendComponent(path);
- path = CWD.toString();
+ path = CWD.str();
}
Path
@@ -502,7 +502,7 @@ static bool AddPermissionBits(const Path &File, int bits) {
// Get the file's current mode.
struct stat buf;
- if (0 != stat(File.toString().c_str(), &buf))
+ if (0 != stat(File.c_str(), &buf))
return false;
// Change the file to have whichever permissions bits from 'bits'
// that the umask would not disable.
@@ -759,7 +759,7 @@ bool
Path::renamePathOnDisk(const Path& newName, std::string* ErrMsg) {
if (0 != ::rename(path.c_str(), newName.c_str()))
return MakeErrMsg(ErrMsg, std::string("can't rename '") + path + "' as '" +
- newName.toString() + "'");
+ newName.str() + "'");
return false;
}
@@ -781,13 +781,13 @@ sys::CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg){
int outFile = -1;
inFile = ::open(Src.c_str(), O_RDONLY);
if (inFile == -1)
- return MakeErrMsg(ErrMsg, Src.toString() +
+ return MakeErrMsg(ErrMsg, Src.str() +
": can't open source file to copy");
outFile = ::open(Dest.c_str(), O_WRONLY|O_CREAT, 0666);
if (outFile == -1) {
::close(inFile);
- return MakeErrMsg(ErrMsg, Dest.toString() +
+ return MakeErrMsg(ErrMsg, Dest.str() +
": can't create destination file for copy");
}
@@ -797,7 +797,7 @@ sys::CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg){
if (errno != EINTR && errno != EAGAIN) {
::close(inFile);
::close(outFile);
- return MakeErrMsg(ErrMsg, Src.toString()+": can't read source file");
+ return MakeErrMsg(ErrMsg, Src.str()+": can't read source file");
}
} else {
char *BufPtr = Buffer;
@@ -807,7 +807,7 @@ sys::CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg){
if (errno != EINTR && errno != EAGAIN) {
::close(inFile);
::close(outFile);
- return MakeErrMsg(ErrMsg, Dest.toString() +
+ return MakeErrMsg(ErrMsg, Dest.str() +
": can't write destination file");
}
} else {
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc
index 14bc7b1377..84e025cd5d 100644
--- a/lib/System/Unix/Program.inc
+++ b/lib/System/Unix/Program.inc
@@ -97,7 +97,7 @@ static bool RedirectIO(const Path *Path, int FD, std::string* ErrMsg) {
// Redirect empty paths to /dev/null
File = "/dev/null";
else
- File = Path->toString();
+ File = Path->str();
// Open the file
int InFD = open(File.c_str(), FD == 0 ? O_RDONLY : O_WRONLY|O_CREAT, 0666);
@@ -156,7 +156,7 @@ Program::Execute(const Path& path,
{
if (!path.canExecute()) {
if (ErrMsg)
- *ErrMsg = path.toString() + " is not executable";
+ *ErrMsg = path.str() + " is not executable";
return false;
}
diff --git a/lib/System/Unix/TimeValue.inc b/lib/System/Unix/TimeValue.inc
index 8dd30b9322..1ae8c7184d 100644
--- a/lib/System/Unix/TimeValue.inc
+++ b/lib/System/Unix/TimeValue.inc
@@ -21,7 +21,7 @@
namespace llvm {
using namespace sys;
-std::string TimeValue::toString() const {
+std::string TimeValue::str() const {
char buffer[32];
time_t ourTime = time_t(this->toEpochTime());
diff --git a/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc
index fccf001b35..46b965f4b0 100644
--- a/lib/System/Win32/Path.inc
+++ b/lib/System/Win32/Path.inc
@@ -808,8 +808,8 @@ CopyFile(const sys::Path &Dest, const sys::Path &Src, std::string* ErrMsg) {
// Can't use CopyFile macro defined in Windows.h because it would mess up the
// above line. We use the expansion it would have in a non-UNICODE build.
if (!::CopyFileA(Src.c_str(), Dest.c_str(), false))
- return MakeErrMsg(ErrMsg, "Can't copy '" + Src.toString() +
- "' to '" + Dest.toString() + "': ");
+ return MakeErrMsg(ErrMsg, "Can't copy '" + Src.str() +
+ "' to '" + Dest.str() + "': ");
return false;
}
diff --git a/lib/System/Win32/Program.inc b/lib/System/Win32/Program.inc
index 005f63157c..804273bf23 100644
--- a/lib/System/Win32/Program.inc
+++ b/lib/System/Win32/Program.inc
@@ -92,7 +92,7 @@ static HANDLE RedirectIO(const Path *path, int fd, std::string* ErrMsg) {
if (path->isEmpty())
fname = "NUL";
else
- fname = path->toString().c_str();
+ fname = path->c_str();
SECURITY_ATTRIBUTES sa;
sa.nLength = sizeof(sa);
@@ -258,11 +258,10 @@ Program::Execute(const Path& path,
CloseHandle(si.hStdError);
// Now return an error if the process didn't get created.
- if (!rc)
- {
+ if (!rc) {
SetLastError(err);
MakeErrMsg(ErrMsg, std::string("Couldn't execute program '") +
- path.toString() + "'");
+ path.str() + "'");
return false;
}
Pid_ = pi.dwProcessId;
diff --git a/lib/System/Win32/TimeValue.inc b/lib/System/Win32/TimeValue.inc
index 0ca87d4233..e37f111fc7 100644
--- a/lib/System/Win32/TimeValue.inc
+++ b/lib/System/Win32/TimeValue.inc
@@ -30,7 +30,7 @@ TimeValue TimeValue::now() {
return t;
}
-std::string TimeValue::toString() const {
+std::string TimeValue::str() const {
#ifdef __MINGW32__
// This ban may be lifted by either:
// (i) a future MinGW version other than 1.0 inherents the __time64_t type, or