As this issue is a bit difficult to debug it is better to make it safe against future changes.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
Can we not just grab the skeleton unit when/if needed instead of asserting in many places?
I agree it could be unified for API simplicity to be always the skeleton unit, thanks for the idea. Done in this patch. Still I believe it should be asserted as unfortunately with the current Unit types it cannot be compile-time checked.
LGTM, I also support that assertions are added. This gives confidence in what's expected and also makes it easier to read/understand whether it's a skeleton/non-skeleton unit that we are dealing with.
I don't mind lldbassert() calls as they are not in release builds, so it is nice to catch things during debug build testing. I prefer that asserts are not used when the program would knowingly crash immediately after the assert. I don't like asserts in code like:
assert(ptr) ptr->foo();
This code will crash both when asserts are enabled and also when they aren't. And the llvm/clang/lldb code is used in a shared library that other tools link against. So the code really shouldn't crash when it is easy to work around and add code to avoid the crash. I still prefer the above code to look like:
assert(ptr) if (ptr) ptr->foo();
As long as the program continues to function correctly without the assert, feel free to add any asserts to help catch issues during development.