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

Adrian Prantl via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 23 11:47:56 PDT 2018


aprantl added inline comments.


================
Comment at: source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp:189
+  // Always normalize our compile unit directory to get rid of redundant
+  // slashes and other path anonalies before we use it for path prepending
+  FileSpec local_spec(local_path, false);
----------------
`// slashes and other path ano*m*alies before we use it for path prepending*.*`


================
Comment at: source/Utility/FileSpec.cpp:105
+//------------------------------------------------------------------
+bool needsNormalization(const llvm::StringRef &path) {
+  for (auto i = path.find('/'); i != llvm::StringRef::npos;
----------------
Are we sure that we need this? Could we use llvm::sys::path::has_relative_path & friends instead? http://llvm.org/doxygen/namespacellvm_1_1sys_1_1path.html


================
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);
----------------
shouldn't this be a more general path separator (we probably have something like this in Support/Path.h)


https://reviews.llvm.org/D45977





More information about the lldb-commits mailing list