[Lldb-commits] [lldb] r223087 - Only normalize FileSpec paths *after* resolving them.

Zachary Turner zturner at google.com
Mon Dec 1 15:13:32 PST 2014


Author: zturner
Date: Mon Dec  1 17:13:32 2014
New Revision: 223087

URL: http://llvm.org/viewvc/llvm-project?rev=223087&view=rev
Log:
Only normalize FileSpec paths *after* resolving them.

Normalizing paths before resolving them can cause the path to
become denormalized after resolution.

Modified:
    lldb/trunk/source/Host/common/FileSpec.cpp

Modified: lldb/trunk/source/Host/common/FileSpec.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/common/FileSpec.cpp?rev=223087&r1=223086&r2=223087&view=diff
==============================================================================
--- lldb/trunk/source/Host/common/FileSpec.cpp (original)
+++ lldb/trunk/source/Host/common/FileSpec.cpp Mon Dec  1 17:13:32 2014
@@ -268,14 +268,18 @@ FileSpec::SetFile (const char *pathname,
         return;
 
     llvm::SmallString<64> normalized(pathname);
-    Normalize(normalized, syntax);
 
     if (resolve)
     {
         FileSpec::Resolve (normalized);
         m_is_resolved = true;
     }
-    
+
+    // Only normalize after resolving the path.  Resolution will modify the path
+    // string, potentially adding wrong kinds of slashes to the path, that need
+    // to be re-normalized.
+    Normalize(normalized, syntax);
+
     llvm::StringRef resolve_path_ref(normalized.c_str());
     llvm::StringRef filename_ref = llvm::sys::path::filename(resolve_path_ref);
     if (!filename_ref.empty())





More information about the lldb-commits mailing list