[clang] [llvm] [mlir] [polly] [llvm] Forward declare VirtualFileSystem (PR #211761)

Alexis Engelke via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 18 06:23:12 PDT 2026


aengelke wrote:

> Have you considered switching the vfs::FileSystem hierarchy from IntrusiveRefCntPtr to std::shared_ptr?

Can we perhaps not use shared_ptr? They are rather expensive (most notably, every increment/decrement is an atomic operation, always with libc++, in libstdc++ once more than one thread exists ([Godbolt](https://godbolt.org/z/a69xaqx8z))) and require vtables, which cause dynamic relocations. Thus, I think we should avoid shared_ptr unless there's a very good reason to use it, and we should never use it in single-threaded contexts.

https://github.com/llvm/llvm-project/pull/211761


More information about the cfe-commits mailing list