[Mlir-commits] [mlir] [mlir] Add support for DIGlobalVariable and DIGlobalVariableExpression (PR #73367)
Christian Ulmann
llvmlistbot at llvm.org
Mon Nov 27 09:03:38 PST 2023
================
@@ -447,6 +466,39 @@ def LLVM_DILocalVariableAttr : LLVM_Attr<"DILocalVariable", "di_local_variable",
let assemblyFormat = "`<` struct(params) `>`";
}
+//===----------------------------------------------------------------------===//
+// DIGlobalVariableExpressionAttr
+//===----------------------------------------------------------------------===//
+
+def LLVM_DIGlobalVariableExpressionAttr : LLVM_Attr<"DIGlobalVariableExpression", "di_global_variable_expression",
+ /*traits=*/[], "MDNodeAttr"> {
+ let parameters = (ins
+ "DIGlobalVariableAttr":$var,
+ OptionalParameter<"DIExpressionAttr">:$expr
+ );
+ let assemblyFormat = "`<` struct(params) `>`";
+ let constBuilderCall = "$0";
+}
+
+//===----------------------------------------------------------------------===//
+// DIGlobalVariableAttr
+//===----------------------------------------------------------------------===//
+
+def LLVM_DIGlobalVariable : LLVM_Attr<"DIGlobalVariable", "di_global_variable",
+ /*traits=*/[], "DINodeAttr"> {
+ let parameters = (ins
+ "DIScopeAttr":$scope,
+ OptionalParameter<"StringAttr">:$name,
+ OptionalParameter<"StringAttr">:$linkageName,
+ OptionalParameter<"DIFileAttr">:$file,
+ OptionalParameter<"unsigned">:$line,
+ OptionalParameter<"DITypeAttr">:$type,
+ OptionalParameter<"bool">:$isLocalToUnit,
+ OptionalParameter<"bool">:$isDefined,
+ OptionalParameter<"unsigned">:$alignInBits);
----------------
Dinistro wrote:
Are you sure that all of these are optional? The LLVM class has ^ `StringRef` accessors for both `name` and `linkageName`, which indicates that they might not be optinoal.
We observed many issues with wrongfully optional parameters that caused nasty bugs.
https://github.com/llvm/llvm-project/pull/73367
More information about the Mlir-commits
mailing list