[Mlir-commits] [mlir] [mlir] Add support for DIGlobalVariable and DIGlobalVariableExpression (PR #73367)

Tobias Gysi llvmlistbot at llvm.org
Thu Nov 30 23:46:52 PST 2023


================
@@ -281,6 +291,28 @@ llvm::DILocation *DebugTranslation::translateLoc(Location loc,
   return translateLoc(loc, scope, /*inlinedAt=*/nullptr);
 }
 
+// Translate the given DWARF expression metadata to to LLVM.
+llvm::DIExpression *
+DebugTranslation::translateExpression(LLVM::DIExpressionAttr attr) {
+  SmallVector<uint64_t, 1> ops;
+  if (attr) {
+    // Append operations their operands to the list.
+    for (const DIExpressionElemAttr &op : attr.getOperations()) {
+      ops.push_back(op.getOpcode());
+      append_range(ops, op.getArguments());
+    }
+  }
+  return llvm::DIExpression::get(llvmCtx, ops);
+}
+
+/// Translate the given global DWARF variable expression to LLVM.
----------------
gysit wrote:

```suggestion
```
You can drop the comment on the declaration since there is one on the definition.

https://github.com/llvm/llvm-project/pull/73367


More information about the Mlir-commits mailing list