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

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Nov 24 12:28:26 PST 2023


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff d625ea12c71813db0da4c2e5867e907da22e22f2 2801a423b1de6237b1a132f6829a8e634a825e4a -- mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h mlir/include/mlir/Target/LLVMIR/ModuleTranslation.h mlir/lib/Conversion/LLVMCommon/TypeConverter.cpp mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp mlir/lib/Target/LLVMIR/DebugImporter.cpp mlir/lib/Target/LLVMIR/DebugImporter.h mlir/lib/Target/LLVMIR/DebugTranslation.cpp mlir/lib/Target/LLVMIR/DebugTranslation.h mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
index 53c0c9b70a..2ae1d2ad82 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMDialect.cpp
@@ -1781,7 +1781,8 @@ void GlobalOp::build(OpBuilder &builder, OperationState &result, Type type,
                      bool isConstant, Linkage linkage, StringRef name,
                      Attribute value, uint64_t alignment, unsigned addrSpace,
                      bool dsoLocal, bool threadLocal, SymbolRefAttr comdat,
-                     ArrayRef<NamedAttribute> attrs, DIGlobalVariableExpressionAttr dbgExpr) {
+                     ArrayRef<NamedAttribute> attrs,
+                     DIGlobalVariableExpressionAttr dbgExpr) {
   result.addAttribute(getSymNameAttrName(result.name),
                       builder.getStringAttr(name));
   result.addAttribute(getGlobalTypeAttrName(result.name), TypeAttr::get(type));
diff --git a/mlir/lib/Target/LLVMIR/DebugImporter.h b/mlir/lib/Target/LLVMIR/DebugImporter.h
index 6e92a88238..977465250b 100644
--- a/mlir/lib/Target/LLVMIR/DebugImporter.h
+++ b/mlir/lib/Target/LLVMIR/DebugImporter.h
@@ -65,7 +65,8 @@ private:
   DILexicalBlockAttr translateImpl(llvm::DILexicalBlock *node);
   DILexicalBlockFileAttr translateImpl(llvm::DILexicalBlockFile *node);
   DIExpressionAttr translateImpl(llvm::DIExpression *node);
-  DIGlobalVariableExpressionAttr translateImpl(llvm::DIGlobalVariableExpression *node);
+  DIGlobalVariableExpressionAttr
+  translateImpl(llvm::DIGlobalVariableExpression *node);
   DIGlobalVariableAttr translateImpl(llvm::DIGlobalVariable *node);
   DILocalVariableAttr translateImpl(llvm::DILocalVariable *node);
   DIModuleAttr translateImpl(llvm::DIModule *node);
diff --git a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
index b2faac162e..249be60135 100644
--- a/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/ModuleTranslation.cpp
@@ -790,7 +790,8 @@ LogicalResult ModuleTranslation::convertGlobals() {
       var->addDebugInfo(globalExpr);
 
       // Get the compile unit (scope) of the the global variable
-      if (const auto compileUnit = cast<llvm::DICompileUnit>(globalVar->getScope());
+      if (const auto compileUnit =
+              cast<llvm::DICompileUnit>(globalVar->getScope());
           compileUnit) {
         // Update the compile unit with this incoming global variable
         compileUnit->replaceGlobalVariables(

``````````

</details>


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


More information about the Mlir-commits mailing list