[PATCH] D144006: [DebugMetadata][DwarfDebug] Support function-local types in lexical block scopes (5/7)
Kristina Bessonova via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 13 05:34:16 PDT 2023
krisb marked 2 inline comments as done.
krisb added inline comments.
================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:698
+ // an inlined function: if a local variable has a templated type with
+ // a function-local type as a template parameter. See PR55680 for details.
+ if (!Scope->isAbstractScope() && !Scope->getInlinedAt()) {
----------------
jmmartinez wrote:
> I cannot find the link to PR55680. Would you mind sharing it?
>
> You could also reference `local-type-as-template-parameter.ll`, your test depicts the issue very clearly.
> I cannot find the link to PR55680. Would you mind sharing it?
>
> You could also reference `local-type-as-template-parameter.ll`, your test depicts the issue very clearly.
Here is the link to the issue https://github.com/llvm/llvm-project/issues/55680.
Mentioned the test in the comment. Thank you!
================
Comment at: llvm/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp:712-714
+ assert(!getAbstractScopeDIEs().count(DS) &&
+ "Abstract DIE for this scope exists!");
+ getAbstractScopeDIEs()[DS] = ScopeDIE;
----------------
jmmartinez wrote:
> NIT: You could use `insert/try_emplace` instead of using `count` and `operator[]`. The assertion would become something like:
> ```
> auto Inserted = getAbstractScopeDIEs().try_emplace(DS, ScopeDIE);
> assert(Inserted.second && "Abstract DIE for this scope exists!");
> return ScopeDIE;
> ```
I'd slightly prefer to keep the original code as it looks a bit more readable to me (in your example, there should be another line to void out unused `Inserted` variable, otherwise it'd cause a warning).
Additional `count()` call in the `assert()` doesn't seem too expensive to me, but if you still think `try_emplace()` is better, I'll change to it.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D144006/new/
https://reviews.llvm.org/D144006
More information about the llvm-commits
mailing list