[Lldb-commits] [PATCH] D62755: [Target] Remove Process::GetCPPLanguageRuntime

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Jun 3 09:44:02 PDT 2019

xiaobai marked an inline comment as done.
xiaobai added a comment.

In D62755#1527004 <https://reviews.llvm.org/D62755#1527004>, @labath wrote:

> However, I just want to add that from an lldb-server POV, even the fact that we pull in the `Process` class into it's dependency graph is a bug.


> So, what I'd do (and what I have been doing so far, but mainly as a passtime effort) was to cut the dependencies way lower that this. Ideally, I wouldn't want to include anything from the `Target` library in lldb-server, possibly by moving some stuff that lldb-server does need to use (MemoryRegionInfo) out of it.

Yeah, I'd like to see this happen as well. My efforts are twofold: Remove non-plugin libraries dependencies on plugin libraries, and move things out of the core libraries into plugins (and possibly new non-plugin libraries, if it makes sense). There are many dependency issues that I'm not yet aware of. I'm hoping to uncover more as I keep decoupling.

Comment at: include/lldb/Target/CPPLanguageRuntime.h:47
+  static CPPLanguageRuntime *GetCPPLanguageRuntime(Process &process) {
+    return static_cast<CPPLanguageRuntime *>(
+        process.GetLanguageRuntime(lldb::eLanguageTypeC_plus_plus));
labath wrote:
> It might be nice to add some glue so we could write `llvm::cast_or_null<CPPLanguageRuntime>(...)` here. The main advantage of that being that we'd automatically get an assert firing if `GetLanguageRuntime` ever returns something which is *not* a CPPLanguageRuntime.
I had thought about doing that, but there's an assertion in GetLanguageRuntime that achieves the same thing imo. I do think that we could move towards a `llvm::cast_or_null` implementation though.



More information about the lldb-commits mailing list