[clang] [llvm] Disentangle DISubprogram ODR type method uniquing from metadata uniquing (PR #217042)

Vladislav Dzhidzhoev via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 22 17:21:42 PST 2026


================
@@ -529,6 +530,9 @@ bool LLParser::validateEndOfModule(bool UpgradeDebugInfo) {
                  "use of undefined value '@" +
                      Twine(ForwardRefValIDs.begin()->first) + "'");
 
+  if (Context.isODRUniquingDebugTypes())
+    Context.getDebugTypeODRUniquer()->finalizeUnresolvedSubprogramDecls();
+
   // Resolve metadata cycles.
----------------
dzhidzhoev wrote:

Thank you!
A little moment: I think, `cast<DIScope>(...)` inside` DISubporgram::getScope()` will assert before `isa<DIScope>(...)` performs the check in
```c++
    assert(isa<DIScope>(NewSP->getScope()) &&
           "Unexpected scope MDNode placeholder");
```
inside `DebugInfoODRUniquer::finalizeUnresolvedSubprogramDecls()`. Should we just drop that assert, considering that it will be run for potentially incorrect IR as well? 

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


More information about the cfe-commits mailing list