about summary refs log tree commit diff
path: root/src/rustllvm/RustWrapper.cpp
diff options
context:
space:
mode:
authorkennytm <kennytm@gmail.com>2018-01-23 17:03:40 +0800
committerGitHub <noreply@github.com>2018-01-23 17:03:40 +0800
commitcb0a8bf7d157d91db9be5b628c1b43e14f5b5d7c (patch)
tree34bedf71d375c8431dd8664f5ba58f06e4a1b6b1 /src/rustllvm/RustWrapper.cpp
parent52f8d2dc35eea1029954b455d8a463a96cbb2d1c (diff)
parente2f6b280ea13e48bff86254549988e61eee37139 (diff)
downloadrust-cb0a8bf7d157d91db9be5b628c1b43e14f5b5d7c.tar.gz
rust-cb0a8bf7d157d91db9be5b628c1b43e14f5b5d7c.zip
Rollup merge of #47610 - cuviper:captured-dwarf, r=eddyb
LLVM5: Update DW_OP_plus to DW_OP_plus_uconst

LLVM <= 4.0 used a non-standard interpretation of `DW_OP_plus`.  In the
DWARF standard, this adds two items on the expressions stack.  LLVM's
behavior was more like DWARF's `DW_OP_plus_uconst` -- adding a constant
that follows the op.  The patch series starting with [D33892] switched
to the standard DWARF interpretation, so we need to follow.

[D33892]: https://reviews.llvm.org/D33892

Fixes #47464
r? @eddyb
Diffstat (limited to 'src/rustllvm/RustWrapper.cpp')
-rw-r--r--src/rustllvm/RustWrapper.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 95130d596e1..0fe533d447b 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -866,7 +866,14 @@ extern "C" int64_t LLVMRustDIBuilderCreateOpDeref() {
   return dwarf::DW_OP_deref;
 }
 
-extern "C" int64_t LLVMRustDIBuilderCreateOpPlus() { return dwarf::DW_OP_plus; }
+extern "C" int64_t LLVMRustDIBuilderCreateOpPlusUconst() {
+#if LLVM_VERSION_GE(5, 0)
+  return dwarf::DW_OP_plus_uconst;
+#else
+  // older LLVM used `plus` to behave like `plus_uconst`.
+  return dwarf::DW_OP_plus;
+#endif
+}
 
 extern "C" void LLVMRustWriteTypeToString(LLVMTypeRef Ty, RustStringRef Str) {
   RawRustStringOstream OS(Str);