================ @@ -136,9 +138,15 @@ struct ModuleDeps { /// determined that the differences are benign for this compilation. std::vector<ModuleID> ClangModuleDeps; - /// Compiler invocation that can be used to build this module. Does not - /// include argv[0]. - std::vector<std::string> BuildArguments; + /// Get (or compute) the compiler invocation that can be used to build this + /// module. Does not include argv[0]. + const std::vector<std::string> &getBuildArguments(); + +private: + friend class ModuleDepCollectorPP; + + std::variant<std::shared_ptr<CowCompilerInvocation>, std::vector<std::string>> + BuildInvocationOrArguments; ---------------- jansvoboda11 wrote:
The size of `ModuleDeps` used to be 200B. Storing `CowCompilerInvocation` directly would increase that to 360B, while just pointing to it keeps it at 208B. WDYT about the trade-offs? Also, this should semantically be `std::unique_ptr`, since we're not sharing the ownership. But I'm not a fan of the move-only semantics that implies. I could wrap it in a unique-ptr-like type that's copyable? https://github.com/llvm/llvm-project/pull/65691 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits