Bläddra i källkod

Use GlobalReplace for replacing unexpected insts with a regex (#6401)

Replace all unexpected instruction ids in a line, not just the first
one. Otherwise you get something like this:
```
// CHECK:STDOUT: impl @<null name>: <unexpected>.inst{{[0-9A-F]+}}.loc20_6 as <unexpected>.inst6000002E.loc20_11;
```
Dana Jansens 5 månader sedan
förälder
incheckning
2b30157726

+ 1 - 1
toolchain/check/testdata/impl/error_recovery.carbon

@@ -288,5 +288,5 @@ impl C as I {
 // CHECK:STDOUT: constants {
 // CHECK:STDOUT: }
 // CHECK:STDOUT:
-// CHECK:STDOUT: impl @<null name>: <unexpected>.inst{{[0-9A-F]+}}.loc9_6 as <unexpected>.inst5800002D.loc9_11;
+// CHECK:STDOUT: impl @<null name>: <unexpected>.inst{{[0-9A-F]+}}.loc9_6 as <unexpected>.inst{{[0-9A-F]+}}.loc9_11;
 // CHECK:STDOUT:

+ 1 - 1
toolchain/testing/file_test.cpp

@@ -329,7 +329,7 @@ auto ToolchainFileTest::DoExtraCheckReplacements(std::string& check_line) const
     // instruction edits including adding/removing singleton instructions.
     static RE2 inst_re(
         R"(((?:import_ref [^,]*, |<unexpected>\.)inst)[0-9A-F]+)");
-    RE2::Replace(&check_line, inst_re, R"(\1{{[0-9A-F]+}})");
+    RE2::GlobalReplace(&check_line, inst_re, R"(\1{{[0-9A-F]+}})");
 
     // Reduce location sensitivity in imports referring to `Core`; this is
     // brittle for small edits, including comment changes.