[clang] c56ec7b - Tooling: Remove dead code for ToolingInvocation::mapVirtualFile
Duncan P. N. Exon Smith via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 9 12:47:27 PST 2020
Author: Duncan P. N. Exon Smith
Date: 2020-11-09T15:45:35-05:00
New Revision: c56ec7bedeb8b90cfef4c3ea8db3addfa34fde68
URL: https://github.com/llvm/llvm-project/commit/c56ec7bedeb8b90cfef4c3ea8db3addfa34fde68
DIFF: https://github.com/llvm/llvm-project/commit/c56ec7bedeb8b90cfef4c3ea8db3addfa34fde68.diff
LOG: Tooling: Remove dead code for ToolingInvocation::mapVirtualFile
Follows through on c4cb3b10dc8c50e46c9fb1b7ae95e3c3c94975d3's FIXME
dating back to 2015. Anyone using this should migrate to
InMemoryFileSystem and/or ClangTool::mapVirtualFile.
Differential Revision: https://reviews.llvm.org/D90885
Added:
Modified:
clang/include/clang/Tooling/Tooling.h
clang/lib/Tooling/Tooling.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/Tooling/Tooling.h b/clang/include/clang/Tooling/Tooling.h
index 4fb0c18be95e..8b3b2e5ad002 100644
--- a/clang/include/clang/Tooling/Tooling.h
+++ b/clang/include/clang/Tooling/Tooling.h
@@ -265,21 +265,12 @@ class ToolInvocation {
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 @@ class ToolInvocation {
bool OwnsAction;
FileManager *Files;
std::shared_ptr<PCHContainerOperations> PCHContainerOps;
- // Maps <file name> -> <file content>.
- llvm::StringMap<StringRef> MappedFileContents;
DiagnosticConsumer *DiagConsumer = nullptr;
};
diff --git a/clang/lib/Tooling/Tooling.cpp b/clang/lib/Tooling/Tooling.cpp
index b0d3f5caf67a..063f4df2da5f 100644
--- a/clang/lib/Tooling/Tooling.cpp
+++ b/clang/lib/Tooling/Tooling.cpp
@@ -319,12 +319,6 @@ ToolInvocation::~ToolInvocation() {
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 @@ bool ToolInvocation::run() {
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));
}
More information about the cfe-commits
mailing list