diff options
| author | The rustc-josh-sync Cronjob Bot <github-actions@github.com> | 2025-09-08 04:10:25 +0000 |
|---|---|---|
| committer | The rustc-josh-sync Cronjob Bot <github-actions@github.com> | 2025-09-08 04:10:25 +0000 |
| commit | 7dcb968a2e64dfc89c8edf2536be2d6818a43a09 (patch) | |
| tree | e3898e64dcb04dfabd6e758cf6a2fe07192af4be /compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | |
| parent | cfc73b5c94243ef41eb705f7de49eb8a1efabdc6 (diff) | |
| parent | 2f3f27bf79ec147fec9d2e7980605307a74067f4 (diff) | |
| download | rust-7dcb968a2e64dfc89c8edf2536be2d6818a43a09.tar.gz rust-7dcb968a2e64dfc89c8edf2536be2d6818a43a09.zip | |
Merge ref '2f3f27bf79ec' from rust-lang/rust
Pull recent changes from https://github.com/rust-lang/rust via Josh. Upstream ref: 2f3f27bf79ec147fec9d2e7980605307a74067f4 Filtered ref: 82a5eafbafdb98eae68193600732388ae4135756 Upstream diff: https://github.com/rust-lang/rust/compare/a1dbb443527bd126452875eb5d5860c1d001d761...2f3f27bf79ec147fec9d2e7980605307a74067f4 This merge was created using https://github.com/rust-lang/josh-sync.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp')
| -rw-r--r-- | compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp index e699e4b9c13..361a5f76551 100644 --- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp +++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp @@ -242,7 +242,7 @@ enum class LLVMRustAttributeKind { MinSize = 4, Naked = 5, NoAlias = 6, - NoCapture = 7, + CapturesAddress = 7, NoInline = 8, NonNull = 9, NoRedZone = 10, @@ -297,12 +297,6 @@ static Attribute::AttrKind fromRust(LLVMRustAttributeKind Kind) { return Attribute::Naked; case LLVMRustAttributeKind::NoAlias: return Attribute::NoAlias; - case LLVMRustAttributeKind::NoCapture: -#if LLVM_VERSION_GE(21, 0) - report_fatal_error("NoCapture doesn't exist in LLVM 21"); -#else - return Attribute::NoCapture; -#endif case LLVMRustAttributeKind::NoCfCheck: return Attribute::NoCfCheck; case LLVMRustAttributeKind::NoInline: @@ -377,6 +371,7 @@ static Attribute::AttrKind fromRust(LLVMRustAttributeKind Kind) { #else report_fatal_error("DeadOnReturn attribute requires LLVM 21 or later"); #endif + case LLVMRustAttributeKind::CapturesAddress: case LLVMRustAttributeKind::CapturesReadOnly: report_fatal_error("Should be handled separately"); } @@ -429,9 +424,9 @@ extern "C" void LLVMRustEraseInstFromParent(LLVMValueRef Instr) { extern "C" LLVMAttributeRef LLVMRustCreateAttrNoValue(LLVMContextRef C, LLVMRustAttributeKind RustAttr) { #if LLVM_VERSION_GE(21, 0) - // LLVM 21 replaced the NoCapture attribute with Captures(none). - if (RustAttr == LLVMRustAttributeKind::NoCapture) { - return wrap(Attribute::getWithCaptureInfo(*unwrap(C), CaptureInfo::none())); + if (RustAttr == LLVMRustAttributeKind::CapturesAddress) { + return wrap(Attribute::getWithCaptureInfo( + *unwrap(C), CaptureInfo(CaptureComponents::Address))); } if (RustAttr == LLVMRustAttributeKind::CapturesReadOnly) { return wrap(Attribute::getWithCaptureInfo( @@ -488,6 +483,9 @@ extern "C" LLVMAttributeRef LLVMRustCreateRangeAttribute(LLVMContextRef C, unsigned NumBits, const uint64_t LowerWords[], const uint64_t UpperWords[]) { + // FIXME(Zalathar): There appears to be no stable guarantee that C++ + // `AttrKind` values correspond directly to the `unsigned KindID` values + // accepted by LLVM-C API functions, though in practice they currently do. return LLVMCreateConstantRangeAttribute(C, Attribute::Range, NumBits, LowerWords, UpperWords); } |
