From f641cb95d2200774dcc9714e6df3917891f2f698 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Mon, 9 Sep 2024 13:42:06 -0700 Subject: [PATCH 1/2] Manually free up disk space on macOS (#4287) This should mitigate the effects of a GitHub regression that reduced space on these runners: https://github.com/actions/runner-images/issues/10511 After this, we're mostly fine, but builds that happen to compile enough of the codebase can bump past it. With this PR we have over 50 GiB of space which is more than we need. See a test run here: https://github.com/carbon-language/carbon-lang/actions/runs/10780743574 --- .github/actions/build-setup-macos/action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/actions/build-setup-macos/action.yml b/.github/actions/build-setup-macos/action.yml index 8697be06d3945..0c23b9b04ccbb 100644 --- a/.github/actions/build-setup-macos/action.yml +++ b/.github/actions/build-setup-macos/action.yml @@ -9,6 +9,15 @@ inputs: runs: using: composite steps: + # Free up disk space as the macOS runners end up using most for Xcode + # versions we don't need and iOS simulators. + - name: Free up disk space + shell: bash + run: | + echo '*** Delete iOS simulators' + xcrun simctl delete all + sudo rm -rf ~/Library/Developer/CoreSimulator/Caches/* + # Install and cache LLVM 16 from Homebrew. # TODO: We can potentially remove this and simplify things when the # Homebrew version of LLVM updates to 16 here: From 43c6259fb228bd4653d53a530082243df005bff2 Mon Sep 17 00:00:00 2001 From: Jon Ross-Perkins Date: Mon, 9 Sep 2024 16:54:35 -0700 Subject: [PATCH 2/2] Update LLVM and fix formatv issues. (#4282) https://github.com/llvm/llvm-project/pull/105745 increased validation of formatv requirements, this fixes a couple issues. Note the CommandLine case was untested, and caught separately. --- MODULE.bazel | 6 +++--- common/command_line.cpp | 10 +++++++--- common/command_line_test.cpp | 11 ++++++++++- toolchain/check/context.cpp | 8 ++++---- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index b17ca51b18b2f..95c86091cbf09 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -135,8 +135,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-08-09. -llvm_project_version = "4c5ef6690040383956461828457ac27f7f912edb" +# HEAD as of 2024-09-06. +llvm_project_version = "876b0e60feb6ee4eabb1c8b52881117ce93b3c4c" # Load a repository for the raw llvm-project, pre-overlay. http_archive( @@ -147,7 +147,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 = "a30da7822f5307bc0aca8c497ffdd6369e3877186e87501e2ac1f3ec5ed1c0b7", + sha256 = "7d9e6a4d1e419657b84a4bdf71d07bbb44d7c290847f7d15a841040af0d58a7b", strip_prefix = "llvm-project-{0}".format(llvm_project_version), urls = ["https://github.com/llvm/llvm-project/archive/{0}.tar.gz".format(llvm_project_version)], ) diff --git a/common/command_line.cpp b/common/command_line.cpp index 6f7efd0de234b..8f1b60b9510ca 100644 --- a/common/command_line.cpp +++ b/common/command_line.cpp @@ -927,9 +927,13 @@ auto Parser::ParseArg(const Arg& arg, bool short_spelling, return ParseFlag(arg, value); } - auto name = - llvm::formatv(short_spelling ? "'-{0}' (short for '--{1}')" : "'--{1}'", - arg.info.short_name, arg.info.name); + std::string name; + if (short_spelling) { + name = llvm::formatv("'-{0}' (short for '--{1}')", arg.info.short_name, + arg.info.name); + } else { + name = llvm::formatv("'--{0}'", arg.info.name); + } if (!value) { // We can't have a positional argument without a value, so we know this is diff --git a/common/command_line_test.cpp b/common/command_line_test.cpp index d0ee8f867da92..37e2b9c582c95 100644 --- a/common/command_line_test.cpp +++ b/common/command_line_test.cpp @@ -194,6 +194,10 @@ TEST(ArgParserTest, ShortArgs) { StrEq("ERROR: Option '-z' (short for '--option2') requires a " "value to be provided and none was.\n")); + EXPECT_THAT(parse({"--option2"}, os), Eq(ParseResult::Error)); + EXPECT_THAT(os.TakeStr(), StrEq("ERROR: Option '--option2' requires a value " + "to be provided and none was.\n")); + EXPECT_THAT(parse({"-xz=123"}, os), Eq(ParseResult::Error)); EXPECT_THAT( os.TakeStr(), @@ -461,10 +465,15 @@ TEST(ArgParserTest, OneOfOption) { EXPECT_THAT(parse({"--option=z"}, llvm::errs()), Eq(ParseResult::Success)); EXPECT_THAT(value, Eq(3)); + TestRawOstream os; + + EXPECT_THAT(parse({"--option"}, os), Eq(ParseResult::Error)); + EXPECT_THAT(os.TakeStr(), StrEq("ERROR: Option '--option' requires a value " + "to be provided and none was.\n")); + constexpr const char* ErrorStr = "ERROR: Option '--option={0}' has an invalid value '{0}'; valid values " "are: 'x', 'y', or 'z'\n"; - TestRawOstream os; EXPECT_THAT(parse({"--option=a"}, os), Eq(ParseResult::Error)); EXPECT_THAT(os.TakeStr(), StrEq(llvm::formatv(ErrorStr, "a"))); diff --git a/toolchain/check/context.cpp b/toolchain/check/context.cpp index 40553c7dc8344..ff92187ffd35c 100644 --- a/toolchain/check/context.cpp +++ b/toolchain/check/context.cpp @@ -432,10 +432,10 @@ static auto GetCorePackage(Context& context, SemIRLoc loc) } } - CARBON_DIAGNOSTIC(CoreNotFound, Error, - "Package `Core` implicitly referenced here, but not found.", - SemIR::NameId); - context.emitter().Emit(loc, CoreNotFound, core_name_id); + CARBON_DIAGNOSTIC( + CoreNotFound, Error, + "Package `Core` implicitly referenced here, but not found."); + context.emitter().Emit(loc, CoreNotFound); return SemIR::NameScopeId::Invalid; }