[Mlir-commits] [mlir] [mlir][debug] Handle DIImportedEntity. (PR #103055)

Abid Qadeer llvmlistbot at llvm.org
Tue Aug 13 13:57:35 PDT 2024


abidh wrote:

> Is there any restriction on the `scope` of a `di_imported_entity`? In general, I wonder if it would be better to attach them to the DISubprogramAttr instead, but that leads to yet another way one can get a cyclic attribute (cc @zyx-billy).

I am not aware of any restriction on the scope. I think it can take any `DIScope` but in most cases it would be `DISubprogram`, `DIFile` or `DICompileUnit`. 

Please correct me if I am wrong but I thought Attributes are sort of readonly once created. So adding a field in `DISubprogramAttr` to hold them would not work as

1. `DIImportedEntity` needs scope so it can only be created once a parent like `DISubprogramAttr` is available.
2. But once `DISubprogramAttr` has been created, we can't later modify it to set a list of imported entities in it.

Similarly, we can't attach attribute or location to `DISubprogramAttr` so attaching list of `DIImportedEntity` to `FuncOp` seemed like the only option to me.

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


More information about the Mlir-commits mailing list