[llvm-commits] [llvm] r120546 - in /llvm/trunk: lib/Support/PathV2.cpp unittests/Support/Path.cpp

Michael J. Spencer bigcheesegs at gmail.com
Tue Nov 30 19:18:17 PST 2010


Author: mspencer
Date: Tue Nov 30 21:18:17 2010
New Revision: 120546

URL: http://llvm.org/viewvc/llvm-project?rev=120546&view=rev
Log:
Support/PathV2: Add filename implementation.

Modified:
    llvm/trunk/lib/Support/PathV2.cpp
    llvm/trunk/unittests/Support/Path.cpp

Modified: llvm/trunk/lib/Support/PathV2.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/PathV2.cpp?rev=120546&r1=120545&r2=120546&view=diff
==============================================================================
--- llvm/trunk/lib/Support/PathV2.cpp (original)
+++ llvm/trunk/lib/Support/PathV2.cpp Tue Nov 30 21:18:17 2010
@@ -553,6 +553,11 @@
   return make_error_code(errc::success);
 }
 
+error_code filename(const StringRef &path, StringRef &result) {
+  result = *(--end(path));
+  return make_error_code(errc::success);
+}
+
 }
 }
 }

Modified: llvm/trunk/unittests/Support/Path.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/Support/Path.cpp?rev=120546&r1=120545&r2=120546&view=diff
==============================================================================
--- llvm/trunk/unittests/Support/Path.cpp (original)
+++ llvm/trunk/unittests/Support/Path.cpp Tue Nov 30 21:18:17 2010
@@ -94,6 +94,9 @@
     if (error_code ec = sys::path::parent_path(*i, res))
       ASSERT_FALSE(ec.message().c_str());
     outs() << "    parent_path: " << res << '\n';
+    if (error_code ec = sys::path::filename(*i, res))
+      ASSERT_FALSE(ec.message().c_str());
+    outs() << "    filename: " << res << '\n';
 
     temp_store = *i;
     if (error_code ec = sys::path::make_absolute(temp_store))





More information about the llvm-commits mailing list