From: Adrian McCarthy Date: Fri, 7 Jun 2019 21:13:30 +0000 (+0000) Subject: Fix lit tests on Windows related to CR+LF X-Git-Tag: llvmorg-10-init~3488 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4447d15aef08b10fddc2f3c5133f32cdbfb7f441;p=platform%2Fupstream%2Fllvm.git Fix lit tests on Windows related to CR+LF Problem discovered in the breakpoint lit test, but probably exists in others. lldb-test splits lines on LF. Input files that are CR+LF separated (as is common on Windows) then resulted in commands being sent to LLDB that ended in CR, which confused the command interpreter. This could be fixed at different levels: 1. Treat '\r' like a tab or space in the argument splitter. 2. Fix the line splitters (plural) in lldb-test. 3. Normalize the test files to LF only. If we did only 3, I'd expect similar problems to recur, so this patch does 1 and 2. I may also do 3 in a separate patch later, but that's tricky because I believe we have some input files that MUST use CR+LF. Differential Revision: https://reviews.llvm.org/D62759 llvm-svn: 362844 --- diff --git a/lldb/source/Utility/Args.cpp b/lldb/source/Utility/Args.cpp index ac79354..77b0d43 100644 --- a/lldb/source/Utility/Args.cpp +++ b/lldb/source/Utility/Args.cpp @@ -95,7 +95,7 @@ ParseSingleArgument(llvm::StringRef command) { bool arg_complete = false; do { // Skip over over regular characters and append them. - size_t regular = command.find_first_of(" \t\"'`\\"); + size_t regular = command.find_first_of(" \t\r\"'`\\"); arg += command.substr(0, regular); command = command.substr(regular); @@ -123,6 +123,7 @@ ParseSingleArgument(llvm::StringRef command) { case ' ': case '\t': + case '\r': // We are not inside any quotes, we just found a space after an argument. // We are done. arg_complete = true; diff --git a/lldb/tools/lldb-test/lldb-test.cpp b/lldb/tools/lldb-test/lldb-test.cpp index aecc778..e5e23fb 100644 --- a/lldb/tools/lldb-test/lldb-test.cpp +++ b/lldb/tools/lldb-test/lldb-test.cpp @@ -312,7 +312,7 @@ int opts::breakpoint::evaluateBreakpoints(Debugger &Dbg) { while (!Rest.empty()) { StringRef Line; std::tie(Line, Rest) = Rest.split('\n'); - Line = Line.ltrim(); + Line = Line.ltrim().rtrim(); if (Line.empty() || Line[0] == '#') continue; @@ -939,7 +939,7 @@ int opts::irmemorymap::evaluateMemoryMapCommands(Debugger &Dbg) { while (!Rest.empty()) { StringRef Line; std::tie(Line, Rest) = Rest.split('\n'); - Line = Line.ltrim(); + Line = Line.ltrim().rtrim(); if (Line.empty() || Line[0] == '#') continue;