jingham added a comment.

In D62755#1525919 <https://reviews.llvm.org/D62755#1525919>, @xiaobai wrote:

> In D62755#1525890 <https://reviews.llvm.org/D62755#1525890>, @aprantl wrote:
>
> > I don't yet see the connection between those goals and this patch, but I 
> > might be missing something. Would CPPLanguageRuntime need to be anything 
> > but a forward declaration in Process.h?
>
>
> I forgot to address this point. CPPLanguageRuntime would not be a forward 
> declaration in Process.h, nor be referred to anywhere in Process.h


Yeah, getting CPPLanguageRuntime out of the general forward declarations does 
seem a worthy goal.  But it would be great to do it in a way that doesn't add 
so much line noise.  I added these methods because it got tiresome to write and 
read the version you are showing...

Maybe we can add a static:

CPPLanguageRuntime *GetCPPLanguageRuntime(Process &process);

to CPPLanguageRuntime.h?

If you are calling LanguageRuntime methods on the CPPLanguageRuntime, you 
shouldn't need the cast and probably shouldn't be including 
CPPLanguageRuntime.h.   So in that case, you'd just do:

#include "Target/LanguageRuntime.h"
...

  LanguageRuntime *cpp_runtime = 
process->GetLanguageRuntime(eLanguageTypeCPlusPlus)
  cpp_runtime->GenericMethod();

which is easy to type and read.

You only need to get a runtime cast as a CPPLanguageRuntime if you are planning 
to call methods that are in CPPLanguageRuntime.h, so you would be including 
that header anyway, and then you could use the convenience method from there to 
improve readability.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D62755/new/

https://reviews.llvm.org/D62755



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to