BTW, I wrote up the rules for the SB API objects here:

http://lldb.llvm.org/SB-api-coding-rules.html

Feel free to add to this if there's anything that isn't clear.

Jim


> On Feb 3, 2015, at 1:14 PM, Greg Clayton <[email protected]> wrote:
> 
> Also one thing to note: if you add anything to the lldb::SB API, you can only 
> have one member variable: a pointer, an std::unique_ptr<> or a 
> std::shared_pointer<>. Why? Because we are vending a C++ interface and you 
> can't change the size of the class. When people link against the lldb.so, 
> they need a consistent API and layout of classes in case they make classes 
> that inherit from or use a lldb::SB class so the layout can never change. So 
> to work around this we have rules:
> 
> 1 - lldb::SB classes have one ivar (ptr, unique_ptr, or shared_ptr) which 
> abstracts you from your implementation and makes sure the size of the 
> lldb::SB object never changes
> 2 - no virtual functions so that all function lookups are based off of a pure 
> name lookup by the dynamic linkers (no vtable that can change on you)
> 3 - No inheritance, or only inheritance based on other lldb::SB classes that 
> obey the same rules


_______________________________________________
lldb-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

Reply via email to