[llvm-commits] [llvm] r118127 - /llvm/trunk/lib/System/Unix/Path.inc
Dan Gohman
gohman at apple.com
Tue Nov 2 17:01:23 PDT 2010
Author: djg
Date: Tue Nov 2 19:01:23 2010
New Revision: 118127
URL: http://llvm.org/viewvc/llvm-project?rev=118127&view=rev
Log:
Remove several unhelpful checks for isValid from sys::Path.
Modified:
llvm/trunk/lib/System/Unix/Path.inc
Modified: llvm/trunk/lib/System/Unix/Path.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/System/Unix/Path.inc?rev=118127&r1=118126&r2=118127&view=diff
==============================================================================
--- llvm/trunk/lib/System/Unix/Path.inc (original)
+++ llvm/trunk/lib/System/Unix/Path.inc Tue Nov 2 19:01:23 2010
@@ -149,10 +149,7 @@
std::string(pathname) + ": can't create temporary directory");
return Path();
}
- Path result;
- result.set(pathname);
- assert(result.isValid() && "mkdtemp didn't create a valid pathname!");
- return result;
+ return Path(pathname);
#elif defined(HAVE_MKSTEMP)
// If no mkdtemp is available, mkstemp can be used to create a temporary file
// which is then removed and created as a directory. We prefer this over
@@ -173,10 +170,7 @@
std::string(pathname) + ": can't create temporary directory");
return Path();
}
- Path result;
- result.set(pathname);
- assert(result.isValid() && "mkstemp didn't create a valid pathname!");
- return result;
+ return Path(pathname);
#elif defined(HAVE_MKTEMP)
// If a system doesn't have mkdtemp(3) or mkstemp(3) but it does have
// mktemp(3) then we'll assume that system (e.g. AIX) has a reasonable
@@ -195,10 +189,7 @@
std::string(TmpName) + ": can't create temporary directory");
return Path();
}
- Path result;
- result.set(TmpName);
- assert(result.isValid() && "mktemp didn't create a valid pathname!");
- return result;
+ return Path(TmpName);
#else
// This is the worst case implementation. tempnam(3) leaks memory unless its
// on an SVID2 (or later) system. On BSD 4.3 it leaks. tmpnam(3) has thread
@@ -219,10 +210,7 @@
std::string(pathname) + ": can't create temporary directory");
return Path();
}
- Path result;
- result.set(pathname);
- assert(result.isValid() && "mkstemp didn't create a valid pathname!");
- return result;
+ return Path(pathname);
#endif
}
@@ -597,10 +585,6 @@
return false;
std::string save(path);
path = a_path;
- if (!isValid()) {
- path = save;
- return false;
- }
return true;
}
@@ -612,10 +596,6 @@
if (!lastIsSlash(path))
path += '/';
path += name;
- if (!isValid()) {
- path = save;
- return false;
- }
return true;
}
@@ -647,8 +627,6 @@
return true;
}
}
- if (!isValid())
- path = save;
return false;
}
More information about the llvm-commits
mailing list