[llvm] [llvm-debuginfo-analyzer] Fix ODR violation in llvm::logicalview::LVObject (PR #140265)

Javier Lopez-Gomez via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 9 08:23:54 PDT 2025


jalopezg-git wrote:

> > That is something to guard with `LLVM_ENABLE_ABI_BREAKING_CHANGES` as that is changing the object layout itself between release and debug builds. However, the returning of the value between `0` and `ID` is something that can remain as `NDEBUG` only.
> 
> LGTM; with `LLVM_BUILD_DEBUG`, I tried to mimic the most probable original intent of `NDEBUG`, but in a way that doesn't break downstream projects. Going for `LLVM_ENABLE_ABI_BREAKING_CHECKS` looks also good and I can change it now. Do we have general consensus?

I have dropped the original patch and went for
- Regarding `LVObject::ID`, temporarily went for `#if !defined(NDEBUG) && LLVM_ENABLE_ABI_BREAKING_CHECKS` (instead of plain `#ifndef NDEBUG`).  This should fix the original issue.  
@CarlosAlbertoEnciso and I are still discussing whether `ID` should be made unconditional (and smaller; currently `uint64_t`) instead.
- Making `LVObject::dump()` non-virtual.  Rationale: `virtual` is not needed (and it calls `print()`, which is virtual anyway.

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


More information about the llvm-commits mailing list