summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2008-05-11 17:37:40 +0000
committerNick Lewycky <nicholas@mxc.ca>2008-05-11 17:37:40 +0000
commitc38c1712f79f5ac5806812d4ebb1fb592a12ad7e (patch)
tree236f971a631d80d4b98e97fe1769b817ff1d6863
parenta38e72d247506d97578e87bd6e0e228b09dd2d24 (diff)
downloadbcm5719-llvm-c38c1712f79f5ac5806812d4ebb1fb592a12ad7e.tar.gz
bcm5719-llvm-c38c1712f79f5ac5806812d4ebb1fb592a12ad7e.zip
Make constructors target-specific. This fixes problems where the path would
include backslashes on Windows. This should fix llvm-ld problems on win32. llvm-svn: 50960
-rw-r--r--llvm/include/llvm/System/Path.h5
-rw-r--r--llvm/lib/System/Unix/Path.inc6
-rw-r--r--llvm/lib/System/Win32/Path.inc12
3 files changed, 19 insertions, 4 deletions
diff --git a/llvm/include/llvm/System/Path.h b/llvm/include/llvm/System/Path.h
index 37c42aa366c..ba251a9dbbc 100644
--- a/llvm/include/llvm/System/Path.h
+++ b/llvm/include/llvm/System/Path.h
@@ -180,7 +180,7 @@ namespace sys {
/// of the path, use the isValid method.
/// @param p The path to assign.
/// @brief Construct a Path from a string.
- explicit Path(const std::string& p) : path(p) {}
+ explicit Path(const std::string& 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
@@ -188,8 +188,7 @@ namespace sys {
/// @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.
- explicit Path(const char *StrStart, unsigned StrLen)
- : path(StrStart, StrStart+StrLen) {}
+ Path(const char *StrStart, unsigned StrLen);
/// @}
/// @name Operators
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc
index 9f4b5914ce0..6035a14d27a 100644
--- a/llvm/lib/System/Unix/Path.inc
+++ b/llvm/lib/System/Unix/Path.inc
@@ -75,6 +75,12 @@ using namespace sys;
extern const char sys::PathSeparator = ':';
+Path::Path(const std::string& p)
+ : path(p) {}
+
+Path::Path(const char *StrStart, unsigned StrLen)
+ : path(StrStart, StrLen) {}
+
bool
Path::isValid() const {
// Check some obvious things
diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc
index ce5fe2a3a5f..b5897053b3c 100644
--- a/llvm/lib/System/Win32/Path.inc
+++ b/llvm/lib/System/Win32/Path.inc
@@ -46,6 +46,16 @@ namespace llvm {
namespace sys {
const char PathSeparator = ';';
+Path::Path(const std::string& p)
+ : path(p) {
+ FlipBackSlashes(path);
+}
+
+Path::Path(const char *StrStart, unsigned StrLen)
+ : path(StrStart, StrLen) {
+ FlipBackSlashes(path);
+}
+
bool
Path::isValid() const {
if (path.empty())
@@ -230,7 +240,7 @@ Path::isRootDirectory() const {
}
std::string Path::getDirname() const {
- return getDirnameCharSep(path, '\\');
+ return getDirnameCharSep(path, '/');
}
std::string
OpenPOWER on IntegriCloud