[Mlir-commits] [mlir] [mlir] Add support for DIGlobalVariable and DIGlobalVariableExpression (PR #73367)
Christian Ulmann
llvmlistbot at llvm.org
Wed Nov 29 00:53:41 PST 2023
================
@@ -782,6 +785,22 @@ LogicalResult ModuleTranslation::convertGlobals() {
var->setVisibility(convertVisibilityToLLVM(op.getVisibility_()));
globalsMapping.try_emplace(op, var);
+
+ // Add debug information if present
+ if (op.getDbgExpr()) {
+ llvm::DIGlobalVariableExpression *diGlobalExpr =
+ debugTranslation->translateGlobalVariableExpression(op.getDbgExpr());
+ llvm::DIGlobalVariable *diGlobalVar = diGlobalExpr->getVariable();
+ var->addDebugInfo(diGlobalExpr);
+
+ // Get the compile unit (scope) of the the global variable
+ if (auto *const compileUnit =
----------------
Dinistro wrote:
Nit: Can you avoid `auto` here?
https://github.com/llvm/llvm-project/pull/73367
More information about the Mlir-commits
mailing list