[llvm-commits] CVS: llvm/lib/System/Linux/Path.cpp

Reid Spencer reid at x10sys.com
Sat Aug 28 22:24:12 PDT 2004



Changes in directory llvm/lib/System/Linux:

Path.cpp updated: 1.1 -> 1.2
---
Log message:

Revise the design of the Path concept per peer review. Too many changes to
note individually but these essence of it is to not derive from 
std::string, clarify the interface, and provide better documentation.
There is now also (untested) implementations for AIX, Darwin, and SunOS.


---
Diffs of the changes:  (+20 -2)

Index: llvm/lib/System/Linux/Path.cpp
diff -u llvm/lib/System/Linux/Path.cpp:1.1 llvm/lib/System/Linux/Path.cpp:1.2
--- llvm/lib/System/Linux/Path.cpp:1.1	Wed Aug 25 01:19:01 2004
+++ llvm/lib/System/Linux/Path.cpp	Sun Aug 29 00:24:01 2004
@@ -13,8 +13,26 @@
 
 //===----------------------------------------------------------------------===//
 //=== WARNING: Implementation here must contain only Linux specific code 
-//===          and must not be generic UNIX code (see ../Unix)
+//===          and must not be generic UNIX code (see ../Unix/Path.cpp)
 //===----------------------------------------------------------------------===//
 
-// Th..Th..Th..Tha's All Folks!
+// Include the generic Unix implementation
 #include "../Unix/Path.cpp"
+
+namespace llvm {
+using namespace sys;
+
+bool 
+Path::is_valid() const {
+  if (path.empty()) 
+    return false;
+  char pathname[MAXPATHLEN];
+  if (0 == realpath(path.c_str(), pathname))
+    if (errno != EACCES && errno != EIO && errno != ENOENT && errno != ENOTDIR)
+      return false;
+  return true;
+}
+
+}
+
+// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab






More information about the llvm-commits mailing list