about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper
diff options
context:
space:
mode:
authorJonas Schievink <jonasschievink@gmail.com>2020-10-29 17:05:23 +0100
committerGitHub <noreply@github.com>2020-10-29 17:05:23 +0100
commit38c34098b10a6311b63db96c3542664843232148 (patch)
tree5cbf8da08babe40ae873bedca9d62130bf432d3a /compiler/rustc_llvm/llvm-wrapper
parent31cfe63fb908dfe3f9dac43ae6a6a11e1d0cc8c3 (diff)
parenta3bff691344ed94ca5ebab8a043141a0e56931d2 (diff)
downloadrust-38c34098b10a6311b63db96c3542664843232148.tar.gz
rust-38c34098b10a6311b63db96c3542664843232148.zip
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.
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
-rw-r--r--compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
index 3beb328339e..869aaa569ca 100644
--- a/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
+++ b/compiler/rustc_llvm/llvm-wrapper/RustWrapper.cpp
@@ -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(