21#include "llvm/Support/Path.h"
22#include "llvm/Support/raw_os_ostream.h"
29 std::shared_ptr<PCHContainerOperations> PCHContainerOps)
30 :
ClangTool(Compilations, SourcePaths,
std::move(PCHContainerOps)) {}
33 return FileToReplaces;
46 &*DiagOpts, &DiagnosticPrinter,
false);
51 llvm::errs() <<
"Skipped some replacements.\n";
54 return saveRewrittenFiles(
Rewrite);
60 Rewrite.getSourceMgr().getFileManager(), FileToReplaces))
66 return Rewrite.overwriteChangedFiles() ? 1 : 0;
70 const std::map<std::string, Replacements> &FileToReplaces,
77 Rewrite.getSourceMgr().getFileManager(), FileToReplaces)) {
78 const std::string &FilePath = FileAndReplaces.first;
79 auto &CurReplaces = FileAndReplaces.second;
86 StringRef Code =
SM.getBufferData(ID);
90 llvm::errs() << llvm::toString(CurStyle.takeError()) <<
"\n";
94 auto NewReplacements =
96 if (!NewReplacements) {
97 llvm::errs() << llvm::toString(NewReplacements.takeError()) <<
"\n";
Defines the clang::FileManager interface and associated types.
Defines the SourceManager interface.
Used for handling and querying diagnostic IDs.
Options for controlling the compiler diagnostics engine.
Concrete class used by the front-end to report problems and issues.
Cached information about one file (either on disk or in the virtual file system).
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Implements support for file system lookup, file system caching, and directory search management.
llvm::ErrorOr< const FileEntry * > getFile(StringRef Filename, bool OpenFile=false, bool CacheFailure=true)
Lookup, cache, and verify the specified file (real or virtual).
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Rewriter - This is the main interface to the rewrite buffers.
This class handles loading and caching of source files into memory.
@ Rewrite
We are substituting template parameters for (typically) other template parameters in order to rewrite...
@ Result
The result type of a method or function.