From 4034fa223d71547c2de234e0dcdc504f61631e53 Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Tue, 25 May 2021 15:21:57 -0700 Subject: [PATCH] Update LLVM (and `llvm-bazel`). (#550) This picks up a newer version of LLVM and the LLVM Bazel integration. The big change here is that we can configure the LLVM targets that are built, which allows us to dramatically reduce the build costs by focusing on a couple of CPUs for the time being. There are a few API updates needed as well. This also rotates the cache version so we start with a clean Bazel cache from here. Otherwise we'd potentially pay the cost of carrying around stale bits of LLVM endlessly. --- .github/workflows/tests.yaml | 2 +- WORKSPACE | 4 ++++ lexer/numeric_literal_test.cpp | 2 +- migrate_cpp/cpp_refactoring/main.cpp | 5 +++-- third_party/llvm-bazel | 2 +- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index ab3dcf39e163..11febbf70a30 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -86,7 +86,7 @@ jobs: # invariants and require us to clear our caches. There is no way to # actually delete them and so instead we can simply bump the counter here. # - # Current cache version: 1 + # Current cache version: 2 - name: Cache Bazel build data uses: actions/cache@v2 with: diff --git a/WORKSPACE b/WORKSPACE index f45a27b0a59f..b84a4921ddae 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -45,6 +45,10 @@ llvm_configure( name = "llvm-project", src_path = "third_party/llvm-project", src_workspace = "@carbon//:WORKSPACE", + targets = [ + "AArch64", + "X86", + ], ) load("@llvm_bazel//:terminfo.bzl", "llvm_terminfo_system") diff --git a/lexer/numeric_literal_test.cpp b/lexer/numeric_literal_test.cpp index 357337aeb821..67b01f3e507b 100644 --- a/lexer/numeric_literal_test.cpp +++ b/lexer/numeric_literal_test.cpp @@ -45,7 +45,7 @@ struct NumericLiteralTest : ::testing::Test { template auto VariantWith(M value_matcher) -> decltype(auto) { return Truly([=](auto&& variant) { - T* value = std::get_if(&variant); + const T* value = std::get_if(&variant); return value && ::testing::Matches(value_matcher)(*value); }); } diff --git a/migrate_cpp/cpp_refactoring/main.cpp b/migrate_cpp/cpp_refactoring/main.cpp index f8178f60844f..d0a50b3bf31f 100644 --- a/migrate_cpp/cpp_refactoring/main.cpp +++ b/migrate_cpp/cpp_refactoring/main.cpp @@ -11,8 +11,9 @@ namespace ct = ::clang::tooling; auto main(int argc, const char** argv) -> int { llvm::cl::OptionCategory category("C++ refactoring options"); - ct::CommonOptionsParser op(argc, argv, category); - ct::RefactoringTool tool(op.getCompilations(), op.getSourcePathList()); + auto parser = ct::CommonOptionsParser::create(argc, argv, category); + ct::RefactoringTool tool(parser->getCompilations(), + parser->getSourcePathList()); // Set up AST matcher callbacks. cam::MatchFinder finder; diff --git a/third_party/llvm-bazel b/third_party/llvm-bazel index e463a75a963d..9705a589f080 160000 --- a/third_party/llvm-bazel +++ b/third_party/llvm-bazel @@ -1 +1 @@ -Subproject commit e463a75a963dc583ef1ccc6122aceaaabd5b8e09 +Subproject commit 9705a589f08022382b06cf0d8eca84816b3ae2ec