This is an archive of the discontinued LLVM Phabricator instance.

[lldb] Introduce a macro to mark methods as unsupported with no replacement
ClosedPublic

Authored by bulbazord on Jun 27 2023, 3:57 PM.

Details

Summary

We already have LLDB_DEPRECATED which is used to mark methods as
deprecated with a message and an alternative to use instead. This is
expresses an intent of "We recognize this functionality is useful but
there are some pitfalls with the interface we have exposed."

In other cases, there are no "alternative" methods to use and the code should be
refactored to avoid using a method entirely. For example,
SBValue::Cast should be avoided in favor of using the expression
evaluator to perform a cast. There isn't a mechanical solution, the
recommendation is to instead refactor your code. This commit introduces a
different macro to distinguish this case from the first.

Diff Detail

Event Timeline

bulbazord created this revision.Jun 27 2023, 3:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2023, 3:57 PM
bulbazord requested review of this revision.Jun 27 2023, 3:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 27 2023, 3:57 PM
mib added inline comments.Jun 27 2023, 4:34 PM
lldb/include/lldb/lldb-defines.h
137–143

If we don't have a fix, we should just use the regular [[deprecated(message)] synthax.

bulbazord added inline comments.Jun 27 2023, 4:35 PM
lldb/include/lldb/lldb-defines.h
137–143

Ah, good point. Will update.

JDevlieghere added a comment.EditedJun 27 2023, 5:01 PM

As discussed offline, I think it's impossible to enforce the semantic difference between the two and we'll inevitable end up with the LLDB_UNSUPPORTED used where LLDB_DEPRECATED should be used but someone didn't know, or worse someone decides to add a third macro to mean something slightly different. My suggestion was to have the two macros be named the same modulo a suffix to indicate whether there's a message or not (for example LLDB_DEPRECATED_FIX or LLDB_DEPRECATED_FIXIT and LLDB_DEPRECATED if there's not).

bulbazord updated this revision to Diff 535199.Jun 27 2023, 5:08 PM

Implement changes after discussing offline with Jonas and Ismail

This revision is now accepted and ready to land.Jun 27 2023, 6:24 PM