Skip to content

Commit 87b1db1

Browse files
committed
addressed some local comments
1 parent a0841d3 commit 87b1db1

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

mlir/include/mlir/Dialect/LLVMIR/LLVMAttrDefs.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -306,7 +306,7 @@ def LLVM_DIExpressionAttr : LLVM_Attr<"DIExpression", "di_expression"> {
306306
//===----------------------------------------------------------------------===//
307307

308308
def LLVM_DIRecursiveTypeAttr : LLVM_Attr<"DIRecursiveType", "di_recursive_type",
309-
/*traits=*/[], "DITypeAttr"> {
309+
/*traits=*/[], "DITypeAttr"> {
310310
let description = [{
311311
This attribute enables recursive DITypes. There are two modes for this
312312
attribute.

mlir/lib/Target/LLVMIR/DebugImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ DISubprogramAttr DebugImporter::translateImpl(llvm::DISubprogram *node) {
178178
std::optional<DISubprogramFlags> subprogramFlags =
179179
symbolizeDISubprogramFlags(node->getSubprogram()->getSPFlags());
180180
// Return nullptr if the scope or type is invalid.
181-
auto scope = cast<DIScopeAttr>(translate(node->getScope()));
181+
auto scope = translate(node->getScope());
182182
if (node->getScope() && !scope)
183183
return nullptr;
184184
DIRecursiveTypeAttrOf<DISubroutineTypeAttr> type = translate(node->getType());

mlir/lib/Target/LLVMIR/DebugTranslation.h

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,27 @@ class DebugTranslation {
8282
llvm::DIGlobalVariable *translateImpl(DIGlobalVariableAttr attr);
8383
llvm::DIModule *translateImpl(DIModuleAttr attr);
8484
llvm::DINamespace *translateImpl(DINamespaceAttr attr);
85-
llvm::DIType *translateImpl(DIRecursiveTypeAttr attr);
8685
llvm::DIScope *translateImpl(DIScopeAttr attr);
8786
llvm::DISubprogram *translateImpl(DISubprogramAttr attr);
8887
llvm::DISubrange *translateImpl(DISubrangeAttr attr);
8988
llvm::DISubroutineType *translateImpl(DISubroutineTypeAttr attr);
9089
llvm::DIType *translateImpl(DITypeAttr attr);
9190

9291
/// Attributes that support self recursion need to implement two methods and
93-
/// hook into the `translateImpl` method of `DIRecursiveTypeAttr`.
92+
/// hook into the `translateImpl` overload for `DIRecursiveTypeAttr`.
9493
/// - `<llvm type> translateImplGetPlaceholder(<mlir type>)`:
9594
/// Translate the DI attr without translating any potentially recursive
9695
/// nested DI attrs.
9796
/// - `void translateImplFillPlaceholder(<mlir type>, <llvm type>)`:
9897
/// Given the placeholder returned by `translateImplGetPlaceholder`, fill
9998
/// any holes by recursively translating nested DI attrs. This method must
10099
/// mutate the placeholder that is passed in, instead of creating a new one.
100+
llvm::DIType *translateImpl(DIRecursiveTypeAttr attr);
101+
102+
/// Get a placeholder DICompositeType without recursing into the elements.
101103
llvm::DICompositeType *translateImplGetPlaceholder(DICompositeTypeAttr attr);
104+
/// Fill out the DICompositeType placeholder by recursively translating the
105+
/// elements.
102106
void translateImplFillPlaceholder(DICompositeTypeAttr attr,
103107
llvm::DICompositeType *placeholder);
104108

@@ -116,12 +120,13 @@ class DebugTranslation {
116120
/// metadata.
117121
DenseMap<Attribute, llvm::DINode *> attrToNode;
118122

119-
/// A mapping from DIRecursiveTypeAttr id to the translated DIType.
123+
/// A mapping from DistinctAttr ID of DIRecursiveTypeAttr to the translated
124+
/// DIType.
120125
llvm::MapVector<DistinctAttr, llvm::DIType *> recursiveTypeMap;
121126

122-
/// A mapping between distinct ID attr for DI nodes that require distinction
123-
/// and the translate LLVM metadata node. This helps identify attrs that
124-
/// should translate into the same LLVM debug node.
127+
/// A mapping between DistinctAttr ID and the translated LLVM metadata node.
128+
/// This helps identify attrs that should translate into the same LLVM debug
129+
/// node.
125130
DenseMap<DistinctAttr, llvm::DINode *> distinctAttrToNode;
126131

127132
/// A mapping between filename and llvm debug file.

0 commit comments

Comments
 (0)