[Lldb-commits] [lldb] r298004 - [Support] Support both Windows and Posix paths on both platforms.

Zachary Turner via lldb-commits lldb-commits at lists.llvm.org
Thu Mar 16 15:28:04 PDT 2017


Author: zturner
Date: Thu Mar 16 17:28:04 2017
New Revision: 298004

URL: http://llvm.org/viewvc/llvm-project?rev=298004&view=rev
Log:
[Support] Support both Windows and Posix paths on both platforms.

Previously which path syntax we supported dependend on what
platform we were compiling LLVM on.  While this is normally
desirable, there are situations where we need to be able to
handle a path that we know was generated on a remote host.
Remote debugging, for example, or parsing debug info.

99% of the code in LLVM for handling paths was platform
agnostic and literally just a few branches were gated behind
pre-processor checks, so this changes those sites to use
runtime checks instead, and adds a flag to every path
API that allows one to override the host native syntax.

Differential Revision: https://reviews.llvm.org/D30858

Modified:
    lldb/trunk/source/Commands/CommandCompletions.cpp
    lldb/trunk/source/Utility/TildeExpressionResolver.cpp

Modified: lldb/trunk/source/Commands/CommandCompletions.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandCompletions.cpp?rev=298004&r1=298003&r2=298004&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandCompletions.cpp (original)
+++ lldb/trunk/source/Commands/CommandCompletions.cpp Thu Mar 16 17:28:04 2017
@@ -123,7 +123,8 @@ static int DiskFilesOrDirectories(const
 
   if (CompletionBuffer.startswith("~")) {
     llvm::StringRef Buffer(CompletionBuffer);
-    size_t FirstSep = Buffer.find_if(path::is_separator);
+    size_t FirstSep =
+        Buffer.find_if([](char c) { return path::is_separator(c); });
 
     llvm::StringRef Username = Buffer.take_front(FirstSep);
     llvm::StringRef Remainder;

Modified: lldb/trunk/source/Utility/TildeExpressionResolver.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/TildeExpressionResolver.cpp?rev=298004&r1=298003&r2=298004&view=diff
==============================================================================
--- lldb/trunk/source/Utility/TildeExpressionResolver.cpp (original)
+++ lldb/trunk/source/Utility/TildeExpressionResolver.cpp Thu Mar 16 17:28:04 2017
@@ -28,9 +28,8 @@ TildeExpressionResolver::~TildeExpressio
 bool StandardTildeExpressionResolver::ResolveExact(
     StringRef Expr, SmallVectorImpl<char> &Output) {
   // We expect the tilde expression to be ONLY the expression itself, and
-  // contain
-  // no separators.
-  assert(!llvm::any_of(Expr, path::is_separator));
+  // contain no separators.
+  assert(!llvm::any_of(Expr, [](char c) { return path::is_separator(c); }));
   assert(Expr.empty() || Expr[0] == '~');
 
   return !fs::real_path(Expr, Output, true);
@@ -40,7 +39,7 @@ bool StandardTildeExpressionResolver::Re
                                                      StringSet<> &Output) {
   // We expect the tilde expression to be ONLY the expression itself, and
   // contain no separators.
-  assert(!llvm::any_of(Expr, path::is_separator));
+  assert(!llvm::any_of(Expr, [](char c) { return path::is_separator(c); }));
   assert(Expr.empty() || Expr[0] == '~');
 
   Output.clear();




More information about the lldb-commits mailing list