summaryrefslogtreecommitdiff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2020-03-19 11:41:41 +0000
committerbors <bors@rust-lang.org>2020-03-19 11:41:41 +0000
commitcf35136850a7698c0da0a76785c1552ed88e1cfd (patch)
treec694b90a17f58fd2680ff3f51859d80b86933728 /src/rustllvm/RustWrapper.cpp
parent6724d584b8e3b5fa5e06466d1e900cdd60953707 (diff)
parent40dea87fbdf2ce943bfe245f0a13d7821831a88b (diff)
downloadrust-try.tar.gz
Auto merge of #68965 - eddyb:mir-inline-scope, r=<try>try
rustc_mir: track inlined callees in SourceScopeData. We now record which MIR scopes are the roots of *other* (inlined) functions's scope trees, which allows us to generate the correct debuginfo in codegen, similar to what LLVM inlining generates. This PR makes the `ui` test `backtrace-debuginfo` pass, if the MIR inliner is turned on by default. Also, `#[track_caller]` is now correct in the face of MIR inlining (cc @anp). r? @rust-lang/wg-mir-opt
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 25cfee3373d..534eea91895 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -705,7 +705,7 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction(
const char *LinkageName, size_t LinkageNameLen,
LLVMMetadataRef File, unsigned LineNo,
LLVMMetadataRef Ty, unsigned ScopeLine, LLVMRustDIFlags Flags,
- LLVMRustDISPFlags SPFlags, LLVMValueRef Fn, LLVMMetadataRef TParam,
+ LLVMRustDISPFlags SPFlags, LLVMValueRef MaybeFn, LLVMMetadataRef TParam,
LLVMMetadataRef Decl) {
DITemplateParameterArray TParams =
DITemplateParameterArray(unwrap<MDTuple>(TParam));
@@ -739,7 +739,8 @@ extern "C" LLVMMetadataRef LLVMRustDIBuilderCreateFunction(
ScopeLine, llvmFlags, IsOptimized, TParams,
unwrapDIPtr<DISubprogram>(Decl));
#endif
- unwrap<Function>(Fn)->setSubprogram(Sub);
+ if (MaybeFn)
+ unwrap<Function>(MaybeFn)->setSubprogram(Sub);
return wrap(Sub);
}
@@ -913,12 +914,12 @@ LLVMRustDIBuilderGetOrCreateArray(LLVMRustDIBuilderRef Builder,
extern "C" LLVMValueRef LLVMRustDIBuilderInsertDeclareAtEnd(
LLVMRustDIBuilderRef Builder, LLVMValueRef V, LLVMMetadataRef VarInfo,
- int64_t *AddrOps, unsigned AddrOpsCount, LLVMValueRef DL,
+ int64_t *AddrOps, unsigned AddrOpsCount, LLVMMetadataRef DL,
LLVMBasicBlockRef InsertAtEnd) {
return wrap(Builder->insertDeclare(
unwrap(V), unwrap<DILocalVariable>(VarInfo),
Builder->createExpression(llvm::ArrayRef<int64_t>(AddrOps, AddrOpsCount)),
- DebugLoc(cast<MDNode>(unwrap<MetadataAsValue>(DL)->getMetadata())),
+ DebugLoc(cast<MDNode>(DL)),
unwrap(InsertAtEnd)));
}
@@ -981,7 +982,7 @@ LLVMRustDICompositeTypeReplaceArrays(LLVMRustDIBuilderRef Builder,
DINodeArray(unwrap<MDTuple>(Params)));
}
-extern "C" LLVMValueRef
+extern "C" LLVMMetadataRef
LLVMRustDIBuilderCreateDebugLocation(LLVMContextRef ContextRef, unsigned Line,
unsigned Column, LLVMMetadataRef Scope,
LLVMMetadataRef InlinedAt) {
@@ -990,7 +991,7 @@ LLVMRustDIBuilderCreateDebugLocation(LLVMContextRef ContextRef, unsigned Line,
DebugLoc debug_loc = DebugLoc::get(Line, Column, unwrapDIPtr<MDNode>(Scope),
unwrapDIPtr<MDNode>(InlinedAt));
- return wrap(MetadataAsValue::get(Context, debug_loc.getAsMDNode()));
+ return wrap(debug_loc.getAsMDNode());
}
extern "C" int64_t LLVMRustDIBuilderCreateOpDeref() {