Skip to content

Commit 02d8813

Browse files
authored
Add a comment in the SB API doc about keeping the SB API's lightweight. (#108462)
1 parent a953982 commit 02d8813

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

lldb/docs/resources/sbapi.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,17 @@ building the LLDB framework for macOS, the headers are processed with
7272
``unifdef`` prior to being copied into the framework bundle to remove macros
7373
involving SWIG.
7474

75+
Another good principle when adding SB API methods is: if you find yourself
76+
implementing a significant algorithm in the SB API method, you should not do
77+
that, but instead look for and then add it - if not found - as a method in the
78+
underlying lldb_private class, and then call that from your SB API method.
79+
If it was a useful algorithm, it's very likely it already exists
80+
because the lldb_private code also needed to do it. And if it doesn't at
81+
present, if it was a useful thing to do, it's likely someone will later need
82+
it in lldb_private and then we end up with two implementations of the same
83+
algorithm. If we keep the SB API code to just what's needed to manage the SB
84+
objects and requests, we won't get into this situation.
85+
7586
Lifetime
7687
--------
7788
Many SB API methods will return strings in the form of ``const char *`` values.

0 commit comments

Comments
 (0)