This revision was automatically updated to reflect the committed changes.
Closed by commit rLLDB361321: [FileSystem] Fix regression in 
FileSystem::Resolve (authored by JDevlieghere, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D62219?vs=200585&id=200593#toc

Repository:
  rLLDB LLDB

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62219/new/

https://reviews.llvm.org/D62219

Files:
  source/Host/common/FileSystem.cpp


Index: source/Host/common/FileSystem.cpp
===================================================================
--- source/Host/common/FileSystem.cpp
+++ source/Host/common/FileSystem.cpp
@@ -241,17 +241,21 @@
   if (path.empty())
     return;
 
-  // Resolve tilde.
-  SmallString<128> original_path(path.begin(), path.end());
+  // Resolve tilde in path.
+  SmallString<128> resolved(path.begin(), path.end());
   StandardTildeExpressionResolver Resolver;
-  Resolver.ResolveFullPath(original_path, path);
+  Resolver.ResolveFullPath(llvm::StringRef(path.begin(), path.size()),
+                           resolved);
 
   // Try making the path absolute if it exists.
-  SmallString<128> absolute_path(path.begin(), path.end());
-  MakeAbsolute(path);
-  if (!Exists(path)) {
-    path.clear();
-    path.append(original_path.begin(), original_path.end());
+  SmallString<128> absolute(resolved.begin(), resolved.end());
+  MakeAbsolute(absolute);
+
+  path.clear();
+  if (Exists(absolute)) {
+    path.append(absolute.begin(), absolute.end());
+  } else {
+    path.append(resolved.begin(), resolved.end());
   }
 }
 


Index: source/Host/common/FileSystem.cpp
===================================================================
--- source/Host/common/FileSystem.cpp
+++ source/Host/common/FileSystem.cpp
@@ -241,17 +241,21 @@
   if (path.empty())
     return;
 
-  // Resolve tilde.
-  SmallString<128> original_path(path.begin(), path.end());
+  // Resolve tilde in path.
+  SmallString<128> resolved(path.begin(), path.end());
   StandardTildeExpressionResolver Resolver;
-  Resolver.ResolveFullPath(original_path, path);
+  Resolver.ResolveFullPath(llvm::StringRef(path.begin(), path.size()),
+                           resolved);
 
   // Try making the path absolute if it exists.
-  SmallString<128> absolute_path(path.begin(), path.end());
-  MakeAbsolute(path);
-  if (!Exists(path)) {
-    path.clear();
-    path.append(original_path.begin(), original_path.end());
+  SmallString<128> absolute(resolved.begin(), resolved.end());
+  MakeAbsolute(absolute);
+
+  path.clear();
+  if (Exists(absolute)) {
+    path.append(absolute.begin(), absolute.end());
+  } else {
+    path.append(resolved.begin(), resolved.end());
   }
 }
 
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to