[Lldb-commits] [PATCH] D45977: Always normalize FileSpec paths.

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 23 14:20:09 PDT 2018

clayborg added inline comments.

Comment at: source/Utility/FileSpec.cpp:105
+bool needsNormalization(const llvm::StringRef &path) {
+  for (auto i = path.find('/'); i != llvm::StringRef::npos;
I only want to scan the string one time. This will return true if this contains relative redundancies or extra slashes, not if the path is relative. "./foo" doesn't need normalization and this will return false, but "foo/." would need to be normalized to "foo", as well as "foo/./bar" and "foo/../bar". So this function is doing something completely different than the LLVM counterparts

Comment at: source/Utility/FileSpec.cpp:107
+  for (auto i = path.find('/'); i != llvm::StringRef::npos;
+       i = path.find('/', i + 1)) {
+    const auto nextChar = safeCharAtIndex(path, i+1);
no as the only caller to this function switches the slashes to '/' already..


More information about the lldb-commits mailing list