[PATCH] D104918: [clang-repl] Implement partial translation units and error recovery.

Vassil Vassilev via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jul 12 06:42:42 PDT 2021


v.g.vassilev added a comment.

In D104918#2870582 <https://reviews.llvm.org/D104918#2870582>, @teemperor wrote:

> @v.g.vassilev For LLDB you need to change the `TypeSystemClang::SetExternalSource` function to this (it just moves the `setHasExternalLexicalStorage` one line up. You can just add that change and the compilation fix to this commit.
>
>   void TypeSystemClang::SetExternalSource(
>       llvm::IntrusiveRefCntPtr<ExternalASTSource> &ast_source_up) {
>     ASTContext &ast = getASTContext();
>     ast.getTranslationUnitDecl()->setHasExternalLexicalStorage(true);
>     ast.setExternalSource(ast_source_up);
>   }
>
> The problem is that a few ASTs in LLDB change the ExternalSource that is originally set, but the LazyGenerationalUpdatePtr remembers the initial ExternalSource and tries to access it to complete the redecl chain (but the original ExternalSource just got replaced and deleted). The better fix is to not even create that original ExternalSource, but I can fix that in a follow up as that seems out of scope for this patch.

Thanks @teemperor! I will add your suggestion and recommit.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104918



More information about the cfe-commits mailing list