Author: gclayton Date: Fri Apr 27 14:10:07 2018 New Revision: 331082 URL: http://llvm.org/viewvc/llvm-project?rev=331082&view=rev Log: Fix build bots after r331049 broke them.
Modified: lldb/trunk/source/Utility/FileSpec.cpp Modified: lldb/trunk/source/Utility/FileSpec.cpp URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/FileSpec.cpp?rev=331082&r1=331081&r2=331082&view=diff ============================================================================== --- lldb/trunk/source/Utility/FileSpec.cpp (original) +++ lldb/trunk/source/Utility/FileSpec.cpp Fri Apr 27 14:10:07 2018 @@ -244,9 +244,13 @@ inline char safeCharAtIndex(const llvm:: //------------------------------------------------------------------ bool needsNormalization(const llvm::StringRef &path, FileSpec::PathSyntax syntax) { - const auto separator = GetPreferredPathSeparator(syntax); - for (auto i = path.find(separator); i != llvm::StringRef::npos; - i = path.find(separator, i + 1)) { + if (path.empty()) + return false; + // We strip off leading "." values so these paths need to be normalized + if (path[0] == '.') + return true; + for (auto i = path.find_first_of("\\/"); i != llvm::StringRef::npos; + i = path.find_first_of("\\/", i + 1)) { const auto next = safeCharAtIndex(path, i+1); switch (next) { case 0: @@ -257,7 +261,7 @@ bool needsNormalization(const llvm::Stri case '\\': // two path separator chars in the middle of a path needs to be // normalized - if (next == separator && i > 0) + if (i > 0) return true; ++i; break; @@ -269,9 +273,7 @@ bool needsNormalization(const llvm::Stri case 0: return true; // ends with "/." case '/': case '\\': - if (next_next == separator) - return true; // contains "/./" - break; + return true; // contains "/./" case '.': { const auto next_next_next = safeCharAtIndex(path, i+3); switch (next_next_next) { @@ -279,9 +281,7 @@ bool needsNormalization(const llvm::Stri case 0: return true; // ends with "/.." case '/': case '\\': - if (next_next_next == separator) - return true; // contains "/../" - break; + return true; // contains "/../" } break; } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits