[Lldb-commits] [PATCH] D64844: [Target] Remove Target::GetScratchClangASTContext

Alex Langford via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 17 11:28:06 PDT 2019


xiaobai added a comment.

In D64844#1589794 <https://reviews.llvm.org/D64844#1589794>, @jingham wrote:

> This seems partly wrong to me.  The point is that the Target holds scratch AST contexts for all the languages it supports.  They are the central repository for the accumulation of effects of expressions evaluated while that target is alive.  For instance, all the user defined types and variables go there. The Target also manages its lifecycle.   For instance, in the swift case if there's a module that we can't import, we have to fall back to making an AST Context for each module we can successfully import and dispatching expressions to the appropriate one of those.
>
> So all the Scratch AST Contexts are properly owned by the target.
>
> This move doesn't keep all the clients from knowing they are getting their hands on a ClangASTContext, so it doesn't seem like it achieves much hiding.  All it does is conceal the ownership of the scratch AST context for C-family languages.


Right, I'm not trying to remove Target's ownership of any scratch type systems. My goal is to remove Target's knowledge about specific scratch type systems. Target shouldn't have to know about ClangASTContext specifically. It should hand out scratch TypeSystems based on what language you give it which it already does today with `GetScratchTypeSystemForLanguage`. I'm not trying to hide this information from clients, I'm trying to hide the knowledge from Target.


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

https://reviews.llvm.org/D64844





More information about the lldb-commits mailing list