summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/llvm/System/Path.h5
-rw-r--r--lib/System/Unix/Path.inc6
-rw-r--r--lib/System/Win32/Path.inc12
3 files changed, 19 insertions, 4 deletions
diff --git a/include/llvm/System/Path.h b/include/llvm/System/Path.h
index 37c42aa..ba251a9 100644
--- a/include/llvm/System/Path.h
+++ b/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/lib/System/Unix/Path.inc b/lib/System/Unix/Path.inc
index 9f4b591..6035a14 100644
--- a/lib/System/Unix/Path.inc
+++ b/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/lib/System/Win32/Path.inc b/lib/System/Win32/Path.inc
index ce5fe2a..b5897053 100644
--- a/lib/System/Win32/Path.inc
+++ b/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