[PATCH] D101793: [clang][AST] Improve AST Reader/Writer memory footprint

Wei Wang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 17 15:51:13 PDT 2021


weiwang added a comment.

In D101793#2760639 <https://reviews.llvm.org/D101793#2760639>, @yaxunl wrote:

> I think the root cause might be duplicated decls are added to Sema::DeclsToCheckForDeferredDiags defined in
>
> https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Sema/Sema.h#L1789
>
> When compiling source codes, a decl is added only once. However if modules are imported, duplicate decls may be added.
>
> We need to avoid adding duplicate decls to Sema::DeclsToCheckForDeferredDiags. However we cannot simply change it to a set since the order is important, otherwise the error message for later code may show up earlier, causing confusion for users. I would suggest to change its type to SetVector, which keeps the order and also avoids duplicates.

Thanks for the suggestion! It does make more sense to use SetVector here. I will try this and report back.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D101793



More information about the cfe-commits mailing list