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

Kristina Bessonova via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 11 01:49:15 PST 2026


================
@@ -334,16 +334,22 @@ bool LLVMContext::shouldDiscardValueNames() const {
   return pImpl->DiscardValueNames;
 }
 
-bool LLVMContext::isODRUniquingDebugTypes() const { return !!pImpl->DITypeMap; }
+bool LLVMContext::isODRUniquingDebugTypes() const {
+  return !!pImpl->ODRUniquer;
+}
 
 void LLVMContext::enableDebugTypeODRUniquing() {
-  if (pImpl->DITypeMap)
+  if (pImpl->ODRUniquer)
     return;
 
-  pImpl->DITypeMap.emplace();
+  pImpl->ODRUniquer.emplace();
+}
+
+DebugInfoODRUniquer *LLVMContext::getDebugTypeODRUniquer() {
+  return &*pImpl->ODRUniquer;
----------------
chbessonova wrote:

Fair enough. But now the dereferencing is hidden under the API, so the contract "check for `isODRUniquingDebugTypes` before using it"  may be not that obvious. I'd at least add a comment, and may be an assert/`return nullptr`. But... up to you, not a blocking issue. 

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


More information about the cfe-commits mailing list