Pārlūkot izejas kodu

Update for llvm::formatv changes (#4427)

dwblaikie changed this upstream:
https://github.com/llvm/llvm-project/pull/112625
Jon Ross-Perkins 1 gadu atpakaļ
vecāks
revīzija
e3950298cf

+ 3 - 3
MODULE.bazel

@@ -139,8 +139,8 @@ bazel_dep(name = "zstd", version = "1.5.6", repo_name = "llvm_zstd")
 
 # We pin to specific upstream commits and try to track top-of-tree reasonably
 # closely rather than pinning to a specific release.
-# HEAD as of 2024-09-25.
-llvm_project_version = "29b92d07746fac26cd64c914bc9c5c3833974f6d"
+# HEAD as of 2024-10-17.
+llvm_project_version = "5033ea73bb01061feb09b3216c74619e1fbefdeb"
 
 # Load a repository for the raw llvm-project, pre-overlay.
 http_archive(
@@ -151,7 +151,7 @@ http_archive(
         "@carbon//bazel/llvm_project:0001_Patch_for_mallinfo2_when_using_Bazel_build_system.patch",
         "@carbon//bazel/llvm_project:0002_Added_Bazel_build_for_compiler_rt_fuzzer.patch",
     ],
-    sha256 = "3e8e93e3749454af4b64f7f34b792a4748b62fc533bca1703d33b2b04e34eb70",
+    sha256 = "9964d7643f3cb1cfabde913b747a2fa2524c469adc847fceee4dd883dbc0482a",
     strip_prefix = "llvm-project-{0}".format(llvm_project_version),
     urls = ["https://github.com/llvm/llvm-project/archive/{0}.tar.gz".format(llvm_project_version)],
 )

+ 1 - 1
toolchain/check/merge.cpp

@@ -284,7 +284,7 @@ static auto CheckRedeclParams(Context& context, SemIRLoc new_decl_loc,
     }
     CARBON_DIAGNOSTIC(RedeclParamListDiffers, Error,
                       "redeclaration differs because of "
-                      "{1:'|missing '}{0:implicit |}parameter list",
+                      "{1:|missing }{0:implicit |}parameter list",
                       BoolAsSelect, BoolAsSelect);
     CARBON_DIAGNOSTIC(RedeclParamListPrevious, Note,
                       "previously declared "

+ 0 - 10
toolchain/diagnostics/format_providers.cpp

@@ -15,11 +15,6 @@ auto llvm::format_provider<Carbon::BoolAsSelect>::format(
     return;
   }
 
-  // Remove wrapping quotes if present.
-  if (style.starts_with('\'') && style.ends_with('\'')) {
-    style = style.drop_front().drop_back();
-  }
-
   auto sep = style.find('|');
   CARBON_CHECK(
       sep != llvm::StringRef::npos,
@@ -48,11 +43,6 @@ auto llvm::format_provider<Carbon::IntAsSelect>::format(
     return;
   }
 
-  // Remove wrapping quotes if present.
-  if (style.starts_with('\'') && style.ends_with('\'')) {
-    style = style.drop_front().drop_back();
-  }
-
   auto cursor = style;
   while (!cursor.empty()) {
     auto case_sep = cursor.find("|");

+ 0 - 10
toolchain/diagnostics/format_providers.h

@@ -17,11 +17,6 @@ namespace Carbon {
 // - Selector, as in `{0:true|false}`. The output string used is separated by a
 //   `|`, with the true case first. the example would yield standard bool
 //   formatting.
-//
-// If needed, the _full_ style string can be wrapped with `'` in order to
-// preserve prefix or suffix whitespace (which is stripped by formatv). For
-// example, `{0:' true | false '}` retains whitespace which would be dropped
-// before `true` and after `false`.
 struct BoolAsSelect {
   // NOLINTNEXTLINE(google-explicit-constructor)
   BoolAsSelect(bool value) : value(value) {}
@@ -51,11 +46,6 @@ struct BoolAsSelect {
 // - default -> `other`
 //
 // As another example, `{0:=1:is|:are}` is a way to handle plural-based output.
-//
-// If needed, the _full_ style string can be wrapped with `'` in order to
-// preserve prefix or suffix whitespace (which is stripped by formatv). For
-// example, `{0:'=0: zero |=1: one '}` retains whitespace which would be dropped
-// after `one`.
 struct IntAsSelect {
   // NOLINTNEXTLINE(google-explicit-constructor)
   IntAsSelect(int value) : value(value) {}

+ 0 - 13
toolchain/diagnostics/format_providers_test.cpp

@@ -28,12 +28,6 @@ TEST(BoolAsSelect, CasesWithNormalFormat) {
 
 TEST(BoolAsSelect, Spaces) {
   constexpr char Format[] = "{0: a | b }";
-  EXPECT_THAT(llvm::formatv(Format, BoolAsSelect(true)).str(), Eq("a "));
-  EXPECT_THAT(llvm::formatv(Format, BoolAsSelect(false)).str(), Eq(" b"));
-}
-
-TEST(BoolAsSelect, QuotedSpaces) {
-  constexpr char Format[] = "{0:' a | b '}";
   EXPECT_THAT(llvm::formatv(Format, BoolAsSelect(true)).str(), Eq(" a "));
   EXPECT_THAT(llvm::formatv(Format, BoolAsSelect(false)).str(), Eq(" b "));
 }
@@ -65,13 +59,6 @@ TEST(IntAsSelect, Spaces) {
   constexpr char Format[] = "{0:=0: zero |=1: one |: default }";
   EXPECT_THAT(llvm::formatv(Format, IntAsSelect(0)).str(), Eq(" zero "));
   EXPECT_THAT(llvm::formatv(Format, IntAsSelect(1)).str(), Eq(" one "));
-  EXPECT_THAT(llvm::formatv(Format, IntAsSelect(2)).str(), Eq(" default"));
-}
-
-TEST(IntAsSelect, QuotedSpaces) {
-  constexpr char Format[] = "{0:'=0: zero |=1: one |: default '}";
-  EXPECT_THAT(llvm::formatv(Format, IntAsSelect(0)).str(), Eq(" zero "));
-  EXPECT_THAT(llvm::formatv(Format, IntAsSelect(1)).str(), Eq(" one "));
   EXPECT_THAT(llvm::formatv(Format, IntAsSelect(2)).str(), Eq(" default "));
 }