Skip to content

Commit 635a8f5

Browse files
committed
apply more review suggestions
1 parent 88250a7 commit 635a8f5

File tree

5 files changed

+8
-15
lines changed

5 files changed

+8
-15
lines changed

mlir/include/mlir/Dialect/LLVMIR/LLVMInterfaces.td

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,6 @@ def LLVM_DIRecursiveTypeAttrInterface
352352
Note that a rec-self without an outer rec-decl with the same recId is
353353
conceptually the same as an "unbound" variable. The context needs to provide
354354
meaning to the rec-self.
355-
356-
This can be avoided by calling the `getUnfoldedBaseType()` method on a
357-
rec-decl, which returns the same type with all matching rec-self instances
358-
replaced with this rec-decl again. This is useful, for example, for fetching
359-
a field out of a recursive struct and maintaining the legality of the field
360-
type.
361355
}];
362356
let cppNamespace = "::mlir::LLVM";
363357
let methods = [

mlir/lib/Dialect/LLVMIR/IR/LLVMAttrs.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ bool DINodeAttr::classof(Attribute attr) {
6969
//===----------------------------------------------------------------------===//
7070

7171
bool DIScopeAttr::classof(Attribute attr) {
72-
return llvm::isa<DICompileUnitAttr, DIFileAttr, DILocalScopeAttr,
73-
DIModuleAttr, DINamespaceAttr, DITypeAttr>(attr);
72+
return llvm::isa<DICompileUnitAttr, DICompositeTypeAttr, DIFileAttr,
73+
DILocalScopeAttr, DIModuleAttr, DINamespaceAttr>(attr);
7474
}
7575

7676
//===----------------------------------------------------------------------===//

mlir/lib/Target/LLVMIR/DebugImporter.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -318,10 +318,10 @@ DINodeAttr DebugImporter::translate(llvm::DINode *node) {
318318
if (DINodeAttr attr = translateNode(node)) {
319319
// If this node was marked as recursive, set its recId.
320320
if (auto recType = dyn_cast<DIRecursiveTypeAttrInterface>(attr)) {
321-
if (DistinctAttr id = translationStack.lookup(node)) {
322-
attr = cast<DINodeAttr>(recType.withRecId(id));
321+
if (DistinctAttr recId = translationStack.lookup(node)) {
322+
attr = cast<DINodeAttr>(recType.withRecId(recId));
323323
// Remove the unbound recursive DistinctAttr ID.
324-
unboundRecursiveSelfRefs.back().erase(id);
324+
unboundRecursiveSelfRefs.back().erase(recId);
325325
}
326326
}
327327

@@ -394,8 +394,7 @@ DistinctAttr DebugImporter::getOrCreateDistinctID(llvm::DINode *node) {
394394

395395
function_ref<DIRecursiveTypeAttrInterface(DistinctAttr)>
396396
DebugImporter::getRecSelfConstructor(llvm::DINode *node) {
397-
using CtorType =
398-
llvm::function_ref<DIRecursiveTypeAttrInterface(DistinctAttr)>;
397+
using CtorType = function_ref<DIRecursiveTypeAttrInterface(DistinctAttr)>;
399398
return TypeSwitch<llvm::DINode *, CtorType>(node)
400399
.Case<llvm::DICompositeType>([](auto *concreteNode) {
401400
return CtorType(decltype(translateImpl(concreteNode))::getRecSelf);

mlir/lib/Target/LLVMIR/DebugImporter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ class DebugImporter {
8888

8989
/// Get the `getRecSelf` constructor for the translated type of `node` if its
9090
/// translated DITypeAttr supports recursion. Otherwise, returns nullptr.
91-
llvm::function_ref<DIRecursiveTypeAttrInterface(DistinctAttr)>
91+
function_ref<DIRecursiveTypeAttrInterface(DistinctAttr)>
9292
getRecSelfConstructor(llvm::DINode *node);
9393

9494
/// A mapping between LLVM debug metadata and the corresponding attribute.

mlir/lib/Target/LLVMIR/DebugTranslation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ DebugTranslation::translateImplGetPlaceholder(DICompositeTypeAttr attr) {
145145
void DebugTranslation::translateImplFillPlaceholder(
146146
DICompositeTypeAttr attr, llvm::DICompositeType *placeholder) {
147147
SmallVector<llvm::Metadata *> elements;
148-
for (auto member : attr.getElements())
148+
for (DINodeAttr member : attr.getElements())
149149
elements.push_back(translate(member));
150150
placeholder->replaceElements(llvm::MDNode::get(llvmCtx, elements));
151151
}

0 commit comments

Comments
 (0)