[Mlir-commits] [mlir] [mlir] Add support for recursive elements in DICompositeAttr. (PR #74948)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Sat Dec 9 12:21:46 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 9596676e6586767e7ae412ed26fbd8e3a16a4c18 ecaf00712fb551df575c061c807b288f0282268c -- mlir/lib/Dialect/LLVMIR/IR/AttrDetail.h mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp mlir/lib/Target/LLVMIR/DebugTranslation.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h
index c38bf1c66b..05b4612917 100644
--- a/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h
+++ b/mlir/include/mlir/Dialect/LLVMIR/LLVMAttrs.h
@@ -24,7 +24,7 @@ namespace mlir {
namespace LLVM {
namespace detail {
- struct DICompositeTypeAttrStorage;
+struct DICompositeTypeAttrStorage;
} // namespace detail
/// This class represents the base attribute for all debug info attributes.
diff --git a/mlir/lib/Dialect/LLVMIR/IR/AttrDetail.h b/mlir/lib/Dialect/LLVMIR/IR/AttrDetail.h
index fd02af42a3..e6cfdfd130 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/AttrDetail.h
+++ b/mlir/lib/Dialect/LLVMIR/IR/AttrDetail.h
@@ -98,7 +98,7 @@ struct DICompositeTypeAttrStorage : public ::mlir::AttributeStorage {
static DICompositeTypeAttrStorage *
construct(AttributeStorageAllocator &allocator, const KeyTy &key) {
auto [tag, name, file, line, scope, baseType, flags, sizeInBits,
- alignInBits, elements, identifier] = key;
+ alignInBits, elements, identifier] = key;
elements = allocator.copyInto(elements);
if (!identifier.empty()) {
identifier = allocator.copyInto(identifier);
@@ -113,7 +113,7 @@ struct DICompositeTypeAttrStorage : public ::mlir::AttributeStorage {
}
LogicalResult mutate(AttributeStorageAllocator &allocator,
- const ArrayRef<DINodeAttr>& elements) {
+ const ArrayRef<DINodeAttr> &elements) {
// Replace the elements.
this->elements = allocator.copyInto(elements);
return success();
diff --git a/mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp b/mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
index c0c2c425d3..302fe6b8a5 100644
--- a/mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
+++ b/mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp
@@ -279,13 +279,13 @@ Attribute DICompositeTypeAttr::parse(AsmParser &parser, Type type) {
} else {
if (parser.parseKeyword(¶mKey)) {
return parser.emitError(parser.getCurrentLocation(),
- "expected parameter name.");
+ "expected parameter name.");
}
}
if (parser.parseEqual()) {
return parser.emitError(parser.getCurrentLocation(),
- "expected `=` following parameter name.");
+ "expected `=` following parameter name.");
}
if (paramKey == "tag") {
@@ -302,49 +302,49 @@ Attribute DICompositeTypeAttr::parse(AsmParser &parser, Type type) {
name = FieldParser<StringAttr>::parse(parser);
if (failed(name)) {
return parser.emitError(parser.getCurrentLocation(),
- "failed to parse parameter 'name'");
+ "failed to parse parameter 'name'");
}
} else if (failed(file) && paramKey == "file") {
file = FieldParser<DIFileAttr>::parse(parser);
if (failed(file)) {
return parser.emitError(parser.getCurrentLocation(),
- "failed to parse parameter 'file'");
+ "failed to parse parameter 'file'");
}
} else if (failed(line) && paramKey == "line") {
line = FieldParser<uint32_t>::parse(parser);
if (failed(line)) {
return parser.emitError(parser.getCurrentLocation(),
- "failed to parse parameter 'line'");
+ "failed to parse parameter 'line'");
}
} else if (failed(scope) && paramKey == "scope") {
scope = FieldParser<DIScopeAttr>::parse(parser);
if (failed(scope)) {
return parser.emitError(parser.getCurrentLocation(),
- "failed to parse parameter 'scope'");
+ "failed to parse parameter 'scope'");
}
} else if (failed(baseType) && paramKey == "baseType") {
baseType = FieldParser<DITypeAttr>::parse(parser);
if (failed(baseType)) {
return parser.emitError(parser.getCurrentLocation(),
- "failed to parse parameter 'baseType'");
+ "failed to parse parameter 'baseType'");
}
} else if (failed(flags) && paramKey == "flags") {
flags = FieldParser<DIFlags>::parse(parser);
if (failed(flags)) {
return parser.emitError(parser.getCurrentLocation(),
- "failed to parse parameter 'flags'");
+ "failed to parse parameter 'flags'");
}
} else if (failed(sizeInBits) && paramKey == "sizeInBits") {
sizeInBits = FieldParser<uint32_t>::parse(parser);
if (failed(sizeInBits)) {
return parser.emitError(parser.getCurrentLocation(),
- "failed to parse parameter 'sizeInBits'");
+ "failed to parse parameter 'sizeInBits'");
}
} else if (failed(alignInBits) && paramKey == "alignInBits") {
alignInBits = FieldParser<uint32_t>::parse(parser);
if (failed(alignInBits)) {
return parser.emitError(parser.getCurrentLocation(),
- "failed to parse parameter 'alignInBits'");
+ "failed to parse parameter 'alignInBits'");
}
} else if (failed(elements) && paramKey == "elements") {
if (expectElements) {
@@ -355,7 +355,7 @@ Attribute DICompositeTypeAttr::parse(AsmParser &parser, Type type) {
elements = FieldParser<SmallVector<DINodeAttr>>::parse(parser);
if (failed(elements)) {
return parser.emitError(parser.getCurrentLocation(),
- "failed to parse parameter 'elements'");
+ "failed to parse parameter 'elements'");
}
if (parser.parseRSquare()) {
@@ -368,8 +368,9 @@ Attribute DICompositeTypeAttr::parse(AsmParser &parser, Type type) {
return success();
}
} else {
- return parser.emitError(parser.getCurrentLocation(), "unknown parameter '")
- << paramKey << "'";
+ return parser.emitError(parser.getCurrentLocation(),
+ "unknown parameter '")
+ << paramKey << "'";
}
return success();
};
diff --git a/mlir/lib/Target/LLVMIR/DebugTranslation.cpp b/mlir/lib/Target/LLVMIR/DebugTranslation.cpp
index e2a8d0fa48..96e986073e 100644
--- a/mlir/lib/Target/LLVMIR/DebugTranslation.cpp
+++ b/mlir/lib/Target/LLVMIR/DebugTranslation.cpp
@@ -143,7 +143,7 @@ DebugTranslation::translateImpl(DICompositeTypeAttr attr) {
attrToNode[attr] = result;
// Translate the elements.
- SmallVector<llvm::Metadata*> elements;
+ SmallVector<llvm::Metadata *> elements;
for (const DINodeAttr member : attr.getElements())
elements.push_back(translate(member));
``````````
</details>
https://github.com/llvm/llvm-project/pull/74948
More information about the Mlir-commits
mailing list