[clang] [clang] Add support for passing FileSystem to buildASTFromCodeWithArgs() (PR #123042)

kadir çetinkaya via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 15 04:55:56 PST 2025


================
@@ -692,11 +692,12 @@ std::unique_ptr<ASTUnit> buildASTFromCodeWithArgs(
     StringRef Code, const std::vector<std::string> &Args, StringRef FileName,
     StringRef ToolName, std::shared_ptr<PCHContainerOperations> PCHContainerOps,
     ArgumentsAdjuster Adjuster, const FileContentMappings &VirtualMappedFiles,
-    DiagnosticConsumer *DiagConsumer) {
+    DiagnosticConsumer *DiagConsumer,
+    IntrusiveRefCntPtr<llvm::vfs::FileSystem> FileSystem) {
   std::vector<std::unique_ptr<ASTUnit>> ASTs;
   ASTBuilderAction Action(ASTs);
   llvm::IntrusiveRefCntPtr<llvm::vfs::OverlayFileSystem> OverlayFileSystem(
-      new llvm::vfs::OverlayFileSystem(llvm::vfs::getRealFileSystem()));
+      new llvm::vfs::OverlayFileSystem(FileSystem));
----------------
kadircet wrote:

nit: `std::move(FileSystem)`

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


More information about the cfe-commits mailing list