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;
83 StringRef Code =
SM.getBufferData(
ID);
87 llvm::errs() << llvm::toString(CurStyle.takeError()) <<
"\n";
91 auto NewReplacements =
93 if (!NewReplacements) {
94 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.
A reference to a FileEntry that includes the name of the file as it was accessed by the FileManager's...
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::Expected< FileEntryRef > getFileRef(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.
The JSON file list parser is used to communicate input to InstallAPI.
@ Rewrite
We are substituting template parameters for (typically) other template parameters in order to rewrite...
@ Result
The result type of a method or function.