From 0691d4827cf8059622356b8d20125a118579185a Mon Sep 17 00:00:00 2001 From: Chandler Carruth Date: Sat, 6 Sep 2025 01:36:10 -0700 Subject: [PATCH] Update LLVM (#6022) Notably, this updates past a major AST refactoring and tries to apply those changes across the toolchain. --- MODULE.bazel | 5 ++--- toolchain/check/cpp_thunk.cpp | 4 ++-- toolchain/check/import_cpp.cpp | 12 +++++------- toolchain/driver/build_runtimes_subcommand.cpp | 2 +- toolchain/sem_ir/inst_namer.h | 2 +- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/MODULE.bazel b/MODULE.bazel index 8e408fb7161a..ca287d5396dd 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -103,14 +103,13 @@ bazel_dep(name = "zstd", version = "1.5.7", 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 2025-08-09. -llvm_project_version = "fc44a4fcd3c54be927c15ddd9211aca1501633e7" +# HEAD as of 2025-08-20. +llvm_project_version = "a6da68ed36d7ecb9edf00262d2a2c1129689399f" # Load a repository for the raw llvm-project, pre-overlay. http_archive( name = "llvm-raw", build_file_content = "# empty", - integrity = "sha256-0iiuvlWDxpxOSP16jhSePSLuba+urpQAlGcUPTLZv8Q=", patch_args = ["-p1"], patches = [ "@carbon//bazel/llvm_project:0001_Patch_for_mallinfo2_when_using_Bazel_build_system.patch", diff --git a/toolchain/check/cpp_thunk.cpp b/toolchain/check/cpp_thunk.cpp index 68a17fdadaab..0dcfe8fc6998 100644 --- a/toolchain/check/cpp_thunk.cpp +++ b/toolchain/check/cpp_thunk.cpp @@ -144,7 +144,7 @@ struct CalleeFunctionInfo { implicit_this_type = method_decl->getThisType(); } effective_return_type = - is_ctor ? ast_context.getRecordType(method_decl->getParent()) + is_ctor ? ast_context.getCanonicalTagType(method_decl->getParent()) : decl->getReturnType(); has_simple_return_type = IsSimpleAbiType(ast_context, effective_return_type); @@ -451,7 +451,7 @@ static auto BuildThunkBody(clang::Sema& sema, info.Constructor) { // In C++, there are no direct calls to constructors, only initialization, // so we need to type-check and build the call ourselves. - auto type = sema.Context.getRecordType( + auto type = sema.Context.getCanonicalTagType( cast(callee_info.decl->getParent())); llvm::SmallVector converted_args; converted_args.reserve(call_args.size()); diff --git a/toolchain/check/import_cpp.cpp b/toolchain/check/import_cpp.cpp index c627615d40a8..f33ec04378da 100644 --- a/toolchain/check/import_cpp.cpp +++ b/toolchain/check/import_cpp.cpp @@ -581,10 +581,8 @@ static auto IsDeclInjectedClassName(const Context& context, const clang::ASTContext& ast_context = context.sem_ir().clang_ast_unit()->getASTContext(); - CARBON_CHECK( - ast_context.getCanonicalType( - ast_context.getRecordType(scope_record_decl)) == - ast_context.getCanonicalType(ast_context.getRecordType(record_decl))); + CARBON_CHECK(ast_context.getCanonicalTagType(scope_record_decl) == + ast_context.getCanonicalTagType(record_decl)); auto class_decl = context.sem_ir().insts().GetAs(clang_decl.inst_id); @@ -1117,7 +1115,7 @@ auto ImportClassDefinitionForClangDecl(Context& context, SemIR::LocId loc_id, // instantiation if necessary. clang::DiagnosticErrorTrap trap(ast->getDiagnostics()); if (!ast->getSema().isCompleteType( - loc, context.ast_context().getTypeDeclType(clang_decl))) { + loc, context.ast_context().getCanonicalTagType(clang_decl))) { // Type is incomplete. Nothing more to do, but tell the caller if we // produced an error. return !trap.hasErrorOccurred(); @@ -1267,7 +1265,7 @@ static auto LookupCustomRecordType(Context& context, // Maps a C++ tag type (class, struct, union, enum) to a Carbon type. static auto MapTagType(Context& context, const clang::TagType& type) -> TypeExpr { - auto* tag_decl = type.getDecl(); + auto* tag_decl = type.getOriginalDecl(); CARBON_CHECK(tag_decl); // Check if the declaration is already mapped. @@ -1810,7 +1808,7 @@ static auto AddDependentUnimportedTypeDecls(const Context& context, } if (const auto* tag_type = type->getAs()) { - AddDependentDecl(context, tag_type->getDecl(), worklist); + AddDependentDecl(context, tag_type->getOriginalDecl(), worklist); } } diff --git a/toolchain/driver/build_runtimes_subcommand.cpp b/toolchain/driver/build_runtimes_subcommand.cpp index a2197a903ba0..b6e822e58563 100644 --- a/toolchain/driver/build_runtimes_subcommand.cpp +++ b/toolchain/driver/build_runtimes_subcommand.cpp @@ -48,7 +48,7 @@ auto BuildRuntimesSubcommand::Run(DriverEnv& driver_env) -> DriverResult { // Don't run Clang when fuzzing, it is known to not be reliable under fuzzing // due to many unfixed issues. - if (!TestAndDiagnoseIfFuzzingExternalLibraries(driver_env, "clang")) { + if (TestAndDiagnoseIfFuzzingExternalLibraries(driver_env, "clang")) { return {.success = false}; } diff --git a/toolchain/sem_ir/inst_namer.h b/toolchain/sem_ir/inst_namer.h index 6c322d96a0c6..04846605b1c9 100644 --- a/toolchain/sem_ir/inst_namer.h +++ b/toolchain/sem_ir/inst_namer.h @@ -110,7 +110,7 @@ class InstNamer { class Name { public: explicit Name() : value_(nullptr) {} - explicit Name(llvm::StringMapIterator it, + explicit Name(llvm::StringMap::iterator it, size_t base_name_size) : value_(&*it), base_name_size_(base_name_size) {}