[PATCH] D11944: Nativize filename in FileManager::getFile().

Richard Smith via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 12 11:45:06 PDT 2015


rsmith added a comment.

In principle, normalizing slashes on Windows makes sense here. But we shouldn't use `llvm::sys::path::native`, because it's just too broken.


================
Comment at: lib/Basic/FileManager.cpp:221-222
@@ -220,1 +220,4 @@
 
+  SmallString<1024> NativeFilename;
+  llvm::sys::path::native(Filename, NativeFilename);
+
----------------
I have two concerns with this:

1) It's needlessly inefficient on non-Win32 platforms (we'll make an unnecessary string copy)
2) It does something bizarre and wrong on non-Win32 platforms (it converts `\` to `/` unless the `\` is followed by another `\`, making most files containing `\` inaccessible)


http://reviews.llvm.org/D11944





More information about the cfe-commits mailing list