Skip to content

Commit 452e883

Browse files
authored
Unrolled build for #146905
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 #146912 as far as I can tell (the test passes.)
2 parents 7cfd7d3 + fe440ec commit 452e883

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1685,6 +1685,14 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
16851685
RemarkStreamer(std::move(RemarkStreamer)),
16861686
LlvmRemarkStreamer(std::move(LlvmRemarkStreamer)) {}
16871687

1688+
#if LLVM_VERSION_GE(22, 0)
1689+
~RustDiagnosticHandler() {
1690+
if (RemarkStreamer) {
1691+
RemarkStreamer->releaseSerializer();
1692+
}
1693+
}
1694+
#endif
1695+
16881696
virtual bool handleDiagnostics(const DiagnosticInfo &DI) override {
16891697
// If this diagnostic is one of the optimization remark kinds, we can
16901698
// check if it's enabled before emitting it. This can avoid many
@@ -1779,9 +1787,14 @@ extern "C" void LLVMRustContextConfigureDiagnosticHandler(
17791787
// Do not delete the file after we gather remarks
17801788
RemarkFile->keep();
17811789

1790+
#if LLVM_VERSION_GE(22, 0)
1791+
auto RemarkSerializer = remarks::createRemarkSerializer(
1792+
llvm::remarks::Format::YAML, RemarkFile->os());
1793+
#else
17821794
auto RemarkSerializer = remarks::createRemarkSerializer(
17831795
llvm::remarks::Format::YAML, remarks::SerializerMode::Separate,
17841796
RemarkFile->os());
1797+
#endif
17851798
if (Error E = RemarkSerializer.takeError()) {
17861799
std::string Error = std::string("Cannot create remark serializer: ") +
17871800
toString(std::move(E));

0 commit comments

Comments
 (0)