Skip to content

Commit 38c3409

Browse files
Rollup merge of #78462 - danielframpton:fixnullisa, r=nagisa
Use unwrapDIPtr because the Scope may be null. I ran into an assertion when using debug information on Windows with LLVM assertions enabled. It seems like we are using unwrap here (which in turn calls isa and requires the pointer to be non-null) but we expect the value to be null because that is what we are passing from rustc. This change uses unwrapDIPtr which explicitly allows nullptr. The FFI prototype for this method on the rust side has the `LLVMMetadataRef` parameter as `Scope: Option<&'a DIScope>`, and we always pass `None` when `msvc_like_names` is true.
2 parents 31cfe63 + a3bff69 commit 38c3409

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateTypedef(
766766
LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Scope) {
767767
return wrap(Builder->createTypedef(
768768
unwrap<DIType>(Type), StringRef(Name, NameLen), unwrap<DIFile>(File),
769-
LineNo, unwrap<DIScope>(Scope)));
769+
LineNo, unwrapDIPtr<DIScope>(Scope)));
770770
}
771771

772772
extern "C" LLVMMetadataRef LLVMRustDIBuilderCreatePointerType(

0 commit comments

Comments
 (0)