summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/System')
-rw-r--r--llvm/lib/System/Unix/Path.inc8
-rw-r--r--llvm/lib/System/Win32/Path.inc14
2 files changed, 22 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Path.inc b/llvm/lib/System/Unix/Path.inc
index d5edee1b03b..1f73571cf14 100644
--- a/llvm/lib/System/Unix/Path.inc
+++ b/llvm/lib/System/Unix/Path.inc
@@ -104,6 +104,14 @@ Path::isValid() const {
}
bool
+Path::isAbsolute(const char *NameStart, unsigned NameLen) {
+ assert(NameStart);
+ if (NameLen == 0)
+ return false;
+ return NameStart[0] == '/';
+}
+
+bool
Path::isAbsolute() const {
if (path.empty())
return false;
diff --git a/llvm/lib/System/Win32/Path.inc b/llvm/lib/System/Win32/Path.inc
index fbf8f6688a5..62da3a34c45 100644
--- a/llvm/lib/System/Win32/Path.inc
+++ b/llvm/lib/System/Win32/Path.inc
@@ -125,6 +125,20 @@ Path::isValid() const {
return true;
}
+bool
+Path::isAbsolute(const char *NameStart, unsigned NameLen) {
+ assert(NameStart);
+ switch (NameLen) {
+ case 0:
+ return false;
+ case 1:
+ case 2:
+ return NameStart[0] == '/';
+ default:
+ return NameStart[0] == '/' || (NameStart[1] == ':' && NameStart[2] == '/');
+ }
+}
+
bool
Path::isAbsolute() const {
switch (path.length()) {
OpenPOWER on IntegriCloud