llvm.org GIT mirror llvm / fff116f
Make constructors target-specific. This fixes problems where the path would include backslashes on Windows. This should fix llvm-ld problems on win32. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@50960 91177308-0d34-0410-b5e6-96231b3b80d8 Nick Lewycky 12 years ago
3 changed file(s) with 19 addition(s) and 4 deletion(s). Raw diff Collapse all Expand all
179179 /// of the path, use the isValid method.
180180 /// @param p The path to assign.
181181 /// @brief Construct a Path from a string.
182 explicit Path(const std::string& p) : path(p) {}
182 explicit Path(const std::string& p);
183183
184184 /// This constructor will accept a character range as a path. No checking
185185 /// is done on this path to determine if it is valid. To determine
187187 /// @param StrStart A pointer to the first character of the path name
188188 /// @param StrLen The length of the path name at StrStart
189189 /// @brief Construct a Path from a string.
190 explicit Path(const char *StrStart, unsigned StrLen)
191 : path(StrStart, StrStart+StrLen) {}
190 Path(const char *StrStart, unsigned StrLen);
192191
193192 /// @}
194193 /// @name Operators
7373 using namespace sys;
7474
7575 extern const char sys::PathSeparator = ':';
76
77 Path::Path(const std::string& p)
78 : path(p) {}
79
80 Path::Path(const char *StrStart, unsigned StrLen)
81 : path(StrStart, StrLen) {}
7682
7783 bool
7884 Path::isValid() const {
4545 namespace sys {
4646 const char PathSeparator = ';';
4747
48 Path::Path(const std::string& p)
49 : path(p) {
50 FlipBackSlashes(path);
51 }
52
53 Path::Path(const char *StrStart, unsigned StrLen)
54 : path(StrStart, StrLen) {
55 FlipBackSlashes(path);
56 }
57
4858 bool
4959 Path::isValid() const {
5060 if (path.empty())
229239 }
230240
231241 std::string Path::getDirname() const {
232 return getDirnameCharSep(path, '\\');
242 return getDirnameCharSep(path, '/');
233243 }
234244
235245 std::string