diff --git a/llvm/utils/lit/lit/TestRunner.py b/llvm/utils/lit/lit/TestRunner.py --- a/llvm/utils/lit/lit/TestRunner.py +++ b/llvm/utils/lit/lit/TestRunner.py @@ -1105,8 +1105,8 @@ # "%{/[STpst]:regex_replacement}" should be normalized like "%/[STpst]" but we're # also in a regex replacement context of a s@@@ regex. def regex_escape(s): - s = s.replace('@', '\@') - s = s.replace('&', '\&') + s = s.replace('@', r'\@') + s = s.replace('&', r'\&') return s substitutions.extend([ ('%{/s:regex_replacement}', diff --git a/llvm/utils/lit/lit/llvm/config.py b/llvm/utils/lit/lit/llvm/config.py --- a/llvm/utils/lit/lit/llvm/config.py +++ b/llvm/utils/lit/lit/llvm/config.py @@ -439,7 +439,7 @@ self.config.substitutions.append( (' clang ', """\"*** Do not use 'clang' in tests, use '%clang'. ***\"""")) self.config.substitutions.append( - (' clang\+\+ ', """\"*** Do not use 'clang++' in tests, use '%clangxx'. ***\"""")) + (r' clang\+\+ ', """\"*** Do not use 'clang++' in tests, use '%clangxx'. ***\"""")) self.config.substitutions.append( (' clang-cc ', """\"*** Do not use 'clang-cc' in tests, use '%clang_cc1'. ***\"""")) @@ -494,11 +494,11 @@ was_found = ld_lld and lld_link and ld64_lld and wasm_ld tool_substitutions = [] if ld_lld: - tool_substitutions.append(ToolSubst('ld\.lld', command=ld_lld)) + tool_substitutions.append(ToolSubst(r'ld\.lld', command=ld_lld)) if lld_link: tool_substitutions.append(ToolSubst('lld-link', command=lld_link)) if ld64_lld: - tool_substitutions.append(ToolSubst('ld64\.lld', command=ld64_lld)) + tool_substitutions.append(ToolSubst(r'ld64\.lld', command=ld64_lld)) if wasm_ld: tool_substitutions.append(ToolSubst('wasm-ld', command=wasm_ld)) self.add_tool_substitutions(tool_substitutions)