This assert is only checked in Debug builds but ignored in all other builds. This replaces this code with lldbassert
which should print a warning to the user in release builds and actually asserts in debug builds.
Details
- Reviewers
davide teemperor - Group Reviewers
Restricted Project - Commits
- rG8b1cd3749eb6: [lldb] Use lldbassert in BuildObjCObjectPointerType
Diff Detail
Event Timeline
Please don't do this. I've seen that assertion triggering. If anything, you might want to make a lldbassert.
Did you investigate why the assertion triggered? Was it because of the forward declaration or was it one of the "other weird cases". To me this change seems perfectly in line with https://lldb.llvm.org/resources/contributing.html
I don't recall the details.
Soft assertions. LLDB provides lldb_assert() as a soft alternative to cover the middle ground of situations that indicate a recoverable bug in LLDB. In a Debug configuration lldb_assert() behaves like assert(). In a Release configuration it will print a warning and encourage the user to file a bug report, similar to LLVM’s crash handler, and then return execution. Use these sparingly and only if error handling is not otherwise feasible. Specifically, new code should not be using lldb_assert() and existing uses should be replaced by other means of error handling.
This is a recoverable bug, in my books.
According to the comment there is at least one valid reason for this code path to trigger. An lldb_assert will encourage users to file bugs and I think we have enough real issues that we can do without the additional noise.
I do believe users should file bugs if this triggers, yes. In the recent past, I looked at ObjC more than most, so these bugs can land on me.
Let's summarize this.
- In the old and the new version, the program is aborted with an assert() if the configuration is LLDB_CONFIGURATION_DEBUG.
- In the old version, nothing happens, when the configuration is non-Debug.
- In the new version, the assert in non-Debug configurations will be turned into a warning and *print a warning and encourage the user to file a bug report* (@JDevlieghere that is the noise you're referring to, right?)