[PATCH] support: add a utility function to canonicalise path separators

NAKAMURA Takumi geek4civic at gmail.com
Thu Mar 6 16:17:21 PST 2014


  I suggest "normalize_path" could do whole normalizations, eg. truncate /./

  And I think the internal separator should be '/' even if we are in win32.
  Just only "native" may use '\\'.


================
Comment at: lib/Support/Unix/Path.inc:278
@@ +277,3 @@
+    if (*PI == '\\' && *(PI + 1) == '\\')
+      ++PI; // increment once, the for loop will increment over the escaped slash
+    else if (*PI == '\\')
----------------
What is "escaped slash"?

================
Comment at: include/llvm/Support/FileSystem.h:277
@@ +276,3 @@
+/// do on Windows, which accepts both characters as a path separtor.
+error_code normalise_separators(SmallVectorImpl<char> &Path);
+
----------------
I suggest s/normalise/normalize/.


http://llvm-reviews.chandlerc.com/D2995



More information about the llvm-commits mailing list