[Lldb-commits] [PATCH] D45703: Use a utility function to speed up "process load image" for POSIX Platforms

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Apr 17 09:38:17 PDT 2018

clayborg added a comment.

In https://reviews.llvm.org/D45703#1069921, @labath wrote:

> I don't think doing this is necessary when we have only one customer, but if we are going to be designing an general purpose storage facility then I don't think we should be using strings (and particularly not ConstStrings) as the lookup keys.
> I would propose going for the the token based approach where each customer has a "token" (it can be just a char) and then you use the address of that token as the key.

a "const void *" is fine as the key. In this case it could be the "Platform *" or the pointer to the ConstString name of the platform plug-in.

> Besides being faster, it is more auditable as only the thing that has access to the token can manipulate the data. Also the system could be extended in the future to store arbitrary objects in a type-safe way by making a Token<T> template.

That is fine. For the helper functions though, I would rather us implement this now even if we have only one customer as the next person will see the pattern and say "I need to add my own custom functions to add accessors for my utility function", so I would rather do this right in this patch if possible.



More information about the lldb-commits mailing list