Skip to content

Commit

Permalink
Rollup merge of #78462 - danielframpton:fixnullisa, r=nagisa
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jonas-schievink committed Oct 29, 2020
2 parents 31cfe63 + a3bff69 commit 38c3409
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateTypedef(
LLVMMetadataRef File, unsigned LineNo, LLVMMetadataRef Scope) {
return wrap(Builder->createTypedef(
unwrap<DIType>(Type), StringRef(Name, NameLen), unwrap<DIFile>(File),
LineNo, unwrap<DIScope>(Scope)));
LineNo, unwrapDIPtr<DIScope>(Scope)));
}

extern "C" LLVMMetadataRef LLVMRustDIBuilderCreatePointerType(
Expand Down

0 comments on commit 38c3409

Please sign in to comment.