Skip to content

Commit e395029

Browse files
authored
Update for llvm::formatv changes (#4427)
dwblaikie changed this upstream: llvm/llvm-project#112625
1 parent 684cda3 commit e395029

File tree

5 files changed

+4
-37
lines changed

5 files changed

+4
-37
lines changed

MODULE.bazel

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ bazel_dep(name = "zstd", version = "1.5.6", repo_name = "llvm_zstd")
139139

140140
# We pin to specific upstream commits and try to track top-of-tree reasonably
141141
# closely rather than pinning to a specific release.
142-
# HEAD as of 2024-09-25.
143-
llvm_project_version = "29b92d07746fac26cd64c914bc9c5c3833974f6d"
142+
# HEAD as of 2024-10-17.
143+
llvm_project_version = "5033ea73bb01061feb09b3216c74619e1fbefdeb"
144144

145145
# Load a repository for the raw llvm-project, pre-overlay.
146146
http_archive(
@@ -151,7 +151,7 @@ http_archive(
151151
"@carbon//bazel/llvm_project:0001_Patch_for_mallinfo2_when_using_Bazel_build_system.patch",
152152
"@carbon//bazel/llvm_project:0002_Added_Bazel_build_for_compiler_rt_fuzzer.patch",
153153
],
154-
sha256 = "3e8e93e3749454af4b64f7f34b792a4748b62fc533bca1703d33b2b04e34eb70",
154+
sha256 = "9964d7643f3cb1cfabde913b747a2fa2524c469adc847fceee4dd883dbc0482a",
155155
strip_prefix = "llvm-project-{0}".format(llvm_project_version),
156156
urls = ["https://github.com/llvm/llvm-project/archive/{0}.tar.gz".format(llvm_project_version)],
157157
)

toolchain/check/merge.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static auto CheckRedeclParams(Context& context, SemIRLoc new_decl_loc,
284284
}
285285
CARBON_DIAGNOSTIC(RedeclParamListDiffers, Error,
286286
"redeclaration differs because of "
287-
"{1:'|missing '}{0:implicit |}parameter list",
287+
"{1:|missing }{0:implicit |}parameter list",
288288
BoolAsSelect, BoolAsSelect);
289289
CARBON_DIAGNOSTIC(RedeclParamListPrevious, Note,
290290
"previously declared "

toolchain/diagnostics/format_providers.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,6 @@ auto llvm::format_provider<Carbon::BoolAsSelect>::format(
1515
return;
1616
}
1717

18-
// Remove wrapping quotes if present.
19-
if (style.starts_with('\'') && style.ends_with('\'')) {
20-
style = style.drop_front().drop_back();
21-
}
22-
2318
auto sep = style.find('|');
2419
CARBON_CHECK(
2520
sep != llvm::StringRef::npos,
@@ -48,11 +43,6 @@ auto llvm::format_provider<Carbon::IntAsSelect>::format(
4843
return;
4944
}
5045

51-
// Remove wrapping quotes if present.
52-
if (style.starts_with('\'') && style.ends_with('\'')) {
53-
style = style.drop_front().drop_back();
54-
}
55-
5646
auto cursor = style;
5747
while (!cursor.empty()) {
5848
auto case_sep = cursor.find("|");

toolchain/diagnostics/format_providers.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ namespace Carbon {
1717
// - Selector, as in `{0:true|false}`. The output string used is separated by a
1818
// `|`, with the true case first. the example would yield standard bool
1919
// formatting.
20-
//
21-
// If needed, the _full_ style string can be wrapped with `'` in order to
22-
// preserve prefix or suffix whitespace (which is stripped by formatv). For
23-
// example, `{0:' true | false '}` retains whitespace which would be dropped
24-
// before `true` and after `false`.
2520
struct BoolAsSelect {
2621
// NOLINTNEXTLINE(google-explicit-constructor)
2722
BoolAsSelect(bool value) : value(value) {}
@@ -51,11 +46,6 @@ struct BoolAsSelect {
5146
// - default -> `other`
5247
//
5348
// As another example, `{0:=1:is|:are}` is a way to handle plural-based output.
54-
//
55-
// If needed, the _full_ style string can be wrapped with `'` in order to
56-
// preserve prefix or suffix whitespace (which is stripped by formatv). For
57-
// example, `{0:'=0: zero |=1: one '}` retains whitespace which would be dropped
58-
// after `one`.
5949
struct IntAsSelect {
6050
// NOLINTNEXTLINE(google-explicit-constructor)
6151
IntAsSelect(int value) : value(value) {}

toolchain/diagnostics/format_providers_test.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,6 @@ TEST(BoolAsSelect, CasesWithNormalFormat) {
2828

2929
TEST(BoolAsSelect, Spaces) {
3030
constexpr char Format[] = "{0: a | b }";
31-
EXPECT_THAT(llvm::formatv(Format, BoolAsSelect(true)).str(), Eq("a "));
32-
EXPECT_THAT(llvm::formatv(Format, BoolAsSelect(false)).str(), Eq(" b"));
33-
}
34-
35-
TEST(BoolAsSelect, QuotedSpaces) {
36-
constexpr char Format[] = "{0:' a | b '}";
3731
EXPECT_THAT(llvm::formatv(Format, BoolAsSelect(true)).str(), Eq(" a "));
3832
EXPECT_THAT(llvm::formatv(Format, BoolAsSelect(false)).str(), Eq(" b "));
3933
}
@@ -65,13 +59,6 @@ TEST(IntAsSelect, Spaces) {
6559
constexpr char Format[] = "{0:=0: zero |=1: one |: default }";
6660
EXPECT_THAT(llvm::formatv(Format, IntAsSelect(0)).str(), Eq(" zero "));
6761
EXPECT_THAT(llvm::formatv(Format, IntAsSelect(1)).str(), Eq(" one "));
68-
EXPECT_THAT(llvm::formatv(Format, IntAsSelect(2)).str(), Eq(" default"));
69-
}
70-
71-
TEST(IntAsSelect, QuotedSpaces) {
72-
constexpr char Format[] = "{0:'=0: zero |=1: one |: default '}";
73-
EXPECT_THAT(llvm::formatv(Format, IntAsSelect(0)).str(), Eq(" zero "));
74-
EXPECT_THAT(llvm::formatv(Format, IntAsSelect(1)).str(), Eq(" one "));
7562
EXPECT_THAT(llvm::formatv(Format, IntAsSelect(2)).str(), Eq(" default "));
7663
}
7764

0 commit comments

Comments
 (0)