about summary refs log tree commit diff
path: root/compiler/rustc_llvm
diff options
context:
space:
mode:
authorStuart Cook <Zalathar@users.noreply.github.com>2025-09-25 20:31:56 +1000
committerGitHub <noreply@github.com>2025-09-25 20:31:56 +1000
commit2565b27cc0b4530a095c5d4f5f580e98b270810a (patch)
treead1d6bd5410dc7c38af1d6e03b2d98e59d03d378 /compiler/rustc_llvm
parent46e25aa7a3f5a63a8447cecdd95b4204dd0047c6 (diff)
parentfe440ec934995e499360dc05ae485f1ccbd0e694 (diff)
downloadrust-2565b27cc0b4530a095c5d4f5f580e98b270810a.tar.gz
rust-2565b27cc0b4530a095c5d4f5f580e98b270810a.zip
Rollup merge of #146905 - durin42:llvm-22-bitstream-remarks, r=nikic
llvm: update remarks support on LLVM 22

LLVM change dfbd76bda01e removed separate remark support entirely, but
it turns out we can just drop the parameter and everything appears to
work fine.

Fixes rust-lang/rust#146912 as far as I can tell (the test passes.)
Diffstat (limited to 'compiler/rustc_llvm')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 414274f24fb..9953f5e1731 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -1685,6 +1685,14 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
           RemarkStreamer(std::move(RemarkStreamer)),
           LlvmRemarkStreamer(std::move(LlvmRemarkStreamer)) {}
 
+#if LLVM_VERSION_GE(22, 0)
+    ~RustDiagnosticHandler() {
+      if (RemarkStreamer) {
+        RemarkStreamer->releaseSerializer();
+      }
+    }
+#endif
+
     virtual bool handleDiagnostics(const DiagnosticInfo &DI) override {
       // If this diagnostic is one of the optimization remark kinds, we can
       // check if it's enabled before emitting it. This can avoid many
@@ -1779,9 +1787,14 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
     // Do not delete the file after we gather remarks
     RemarkFile->keep();
 
+#if LLVM_VERSION_GE(22, 0)
+    auto RemarkSerializer = remarks::createRemarkSerializer(
+        llvm::remarks::Format::YAML, RemarkFile->os());
+#else
     auto RemarkSerializer = remarks::createRemarkSerializer(
         llvm::remarks::Format::YAML, remarks::SerializerMode::Separate,
         RemarkFile->os());
+#endif
     if (Error E = RemarkSerializer.takeError()) {
       std::string Error = std::string("Cannot create remark serializer: ") +
                           toString(std::move(E));