================
@@ -113,7 +113,7 @@ class PragmaIncludes {
   llvm::DenseSet<llvm::sys::fs::UniqueID> ShouldKeep;
 
   /// Owns the strings.
-  llvm::BumpPtrAllocator Arena;
+  std::shared_ptr<llvm::BumpPtrAllocator> Arena;
----------------
kadircet wrote:

you're right in theory, but in practice we actually never build ASTs 
concurrently from a preamble in clangd (we've a single ASTWorker peer per 
preamble). Moreover mutating the same arena bit is actually never the case, but 
quite subtle. We build the arena specifically in PPCallbacks and just move it 
to PI at the end. Hence in practice we have 2 separate PIs, one inside 
preamble, whose arena is never mutated. Another in ParsedAST, which can refer 
to strings both inside its own Arena, but also to the arena "kept" alive by the 
preamble. so I think this was safe for clangd, but too subtle to keep working 
in the long run I guess.

storing a vector of const arenas in PI instead, and changing the `record` to 
just push each arena to the end, rather than overwriting the existing Arena 
(while extending all other structures).

https://github.com/llvm/llvm-project/pull/75612
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to