[lldb-dev] RFC: Namespaces in lldb

jingham at apple.com jingham at apple.com
Fri Mar 20 11:30:00 PDT 2015


> On Mar 20, 2015, at 9:57 AM, jingham at apple.com wrote:
> 
> My take:
> 
> Local classes that are in just in .cpp files should go in the anonymous namespace.  We didn't start out doing it that way, not all local classes follows this rule.  Thats just a bug, feel free to fix that wherever you come across it.  Everything else should be in lldb or lldb_private.  Anything that might be useful to for the SB API's but is also useful for core lldb should be in the lldb namespace.  Everything else should be in lldb_private.

Note, BTW, if you fix some local class to put it in the anonymous namespace, be sure to follow the LLVM rules for classes in anonymous namespaces (put only the declarations in the anonymous namespace, and put all method bodies outside the namespace {} construct.)

Jim


> 
> I don't think we need to split it finer than that at present.  I don't see any reason to leave any classes in the global namespace, but again I think where we are doing that it is just because we didn't start out putting all our local classes in the anonymous namespace.
> 
> Jim
> 
>> On Mar 20, 2015, at 4:58 AM, Tamas Berghammer <tberghammer at google.com> wrote:
>> 
>> Hi All,
>> 
>> In lldb I see that most of the classes are leaving in the lldb or in the lldb_private namespace but we have some class in the global scope. What is the rule we want to use about placing our classes in namespaces? When we want to put a class into lldb, when we want to put it into lldb_private and when we want to leave it in the global scope (do we want to leave anything in the global namespace)?
>> 
>> The current stage is that we have the classes in "lldb/API" and a few other files in the lldb namespace, a lot of thing in the lldb_private namespace and some class in the global namespace. As a first approximation I would suggest to keep the classes in "lldb/API" in the lldb namespace and everything else in lldb_private but it might not be sufficient in all cases. 
>> 
>> I think this issue doesn't cause us any major problem right now, so I don't plan to move every class to the proper namespace with a few commits but I hope we can make an agreement about what is the preferred location for the different classes and then make progress to move them to the right place (e.g.: when somebody do bigger changes to a class what is not in the correct namespace he/she can also move it to the right place).
>> 
>> Tamas
>> _______________________________________________
>> lldb-dev mailing list
>> lldb-dev at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-dev
> 





More information about the lldb-dev mailing list