This revision was automatically updated to reflect the committed changes. Closed by commit rGc56ec7bedeb8: Tooling: Remove dead code for ToolingInvocation::mapVirtualFile (authored by dexonsmith). Herald added a project: clang.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D90885/new/ https://reviews.llvm.org/D90885 Files: clang/include/clang/Tooling/Tooling.h clang/lib/Tooling/Tooling.cpp Index: clang/lib/Tooling/Tooling.cpp =================================================================== --- clang/lib/Tooling/Tooling.cpp +++ clang/lib/Tooling/Tooling.cpp @@ -319,12 +319,6 @@ delete Action; } -void ToolInvocation::mapVirtualFile(StringRef FilePath, StringRef Content) { - SmallString<1024> PathStorage; - llvm::sys::path::native(FilePath, PathStorage); - MappedFileContents[PathStorage] = Content; -} - bool ToolInvocation::run() { std::vector<const char*> Argv; for (const std::string &Str : CommandLine) @@ -359,14 +353,6 @@ return false; std::unique_ptr<CompilerInvocation> Invocation( newInvocation(&Diagnostics, *CC1Args, BinaryName)); - // FIXME: remove this when all users have migrated! - for (const auto &It : MappedFileContents) { - // Inject the code as the given file name into the preprocessor options. - std::unique_ptr<llvm::MemoryBuffer> Input = - llvm::MemoryBuffer::getMemBuffer(It.getValue()); - Invocation->getPreprocessorOpts().addRemappedFile(It.getKey(), - Input.release()); - } return runInvocation(BinaryName, Compilation.get(), std::move(Invocation), std::move(PCHContainerOps)); } Index: clang/include/clang/Tooling/Tooling.h =================================================================== --- clang/include/clang/Tooling/Tooling.h +++ clang/include/clang/Tooling/Tooling.h @@ -265,21 +265,12 @@ this->DiagConsumer = DiagConsumer; } - /// Map a virtual file to be used while running the tool. - /// - /// \param FilePath The path at which the content will be mapped. - /// \param Content A null terminated buffer of the file's content. - // FIXME: remove this when all users have migrated! - void mapVirtualFile(StringRef FilePath, StringRef Content); - /// Run the clang invocation. /// /// \returns True if there were no errors during execution. bool run(); private: - void addFileMappingsTo(SourceManager &SourceManager); - bool runInvocation(const char *BinaryName, driver::Compilation *Compilation, std::shared_ptr<CompilerInvocation> Invocation, @@ -290,8 +281,6 @@ bool OwnsAction; FileManager *Files; std::shared_ptr<PCHContainerOperations> PCHContainerOps; - // Maps <file name> -> <file content>. - llvm::StringMap<StringRef> MappedFileContents; DiagnosticConsumer *DiagConsumer = nullptr; };
Index: clang/lib/Tooling/Tooling.cpp =================================================================== --- clang/lib/Tooling/Tooling.cpp +++ clang/lib/Tooling/Tooling.cpp @@ -319,12 +319,6 @@ delete Action; } -void ToolInvocation::mapVirtualFile(StringRef FilePath, StringRef Content) { - SmallString<1024> PathStorage; - llvm::sys::path::native(FilePath, PathStorage); - MappedFileContents[PathStorage] = Content; -} - bool ToolInvocation::run() { std::vector<const char*> Argv; for (const std::string &Str : CommandLine) @@ -359,14 +353,6 @@ return false; std::unique_ptr<CompilerInvocation> Invocation( newInvocation(&Diagnostics, *CC1Args, BinaryName)); - // FIXME: remove this when all users have migrated! - for (const auto &It : MappedFileContents) { - // Inject the code as the given file name into the preprocessor options. - std::unique_ptr<llvm::MemoryBuffer> Input = - llvm::MemoryBuffer::getMemBuffer(It.getValue()); - Invocation->getPreprocessorOpts().addRemappedFile(It.getKey(), - Input.release()); - } return runInvocation(BinaryName, Compilation.get(), std::move(Invocation), std::move(PCHContainerOps)); } Index: clang/include/clang/Tooling/Tooling.h =================================================================== --- clang/include/clang/Tooling/Tooling.h +++ clang/include/clang/Tooling/Tooling.h @@ -265,21 +265,12 @@ this->DiagConsumer = DiagConsumer; } - /// Map a virtual file to be used while running the tool. - /// - /// \param FilePath The path at which the content will be mapped. - /// \param Content A null terminated buffer of the file's content. - // FIXME: remove this when all users have migrated! - void mapVirtualFile(StringRef FilePath, StringRef Content); - /// Run the clang invocation. /// /// \returns True if there were no errors during execution. bool run(); private: - void addFileMappingsTo(SourceManager &SourceManager); - bool runInvocation(const char *BinaryName, driver::Compilation *Compilation, std::shared_ptr<CompilerInvocation> Invocation, @@ -290,8 +281,6 @@ bool OwnsAction; FileManager *Files; std::shared_ptr<PCHContainerOperations> PCHContainerOps; - // Maps <file name> -> <file content>. - llvm::StringMap<StringRef> MappedFileContents; DiagnosticConsumer *DiagConsumer = nullptr; };
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits