9#ifndef LLVM_CLANG_ARCMIGRATE_FILEREMAPPER_H
10#define LLVM_CLANG_ARCMIGRATE_FILEREMAPPER_H
14#include "llvm/ADT/DenseMap.h"
15#include "llvm/ADT/STLExtras.h"
16#include "llvm/ADT/StringRef.h"
22 class MemoryBufferRef;
27 class DiagnosticsEngine;
28 class PreprocessorOptions;
34 std::unique_ptr<FileManager> FileMgr;
36 using Target = std::variant<FileEntryRef, llvm::MemoryBuffer *>;
37 using MappingsTy = llvm::DenseMap<FileEntryRef, Target>;
38 MappingsTy FromToMappings;
40 llvm::DenseMap<const FileEntry *, FileEntryRef> ToFromMappings;
47 bool ignoreIfFilesChanged);
49 bool ignoreIfFilesChanged);
54 StringRef outputDir = StringRef());
56 void remap(StringRef filePath, std::unique_ptr<llvm::MemoryBuffer> memBuf);
62 llvm::function_ref<
void(StringRef, StringRef)> CaptureFile,
63 llvm::function_ref<
void(StringRef,
const llvm::MemoryBufferRef &)>
66 void clear(StringRef outputDir = StringRef());
73 void resetTarget(Target &targ);
77 std::string getRemapInfoFile(StringRef outputDir);
Defines interfaces for clang::FileEntry and clang::FileEntryRef.
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
static DiagnosticBuilder Diag(DiagnosticsEngine *Diags, const LangOptions &Features, FullSourceLoc TokLoc, const char *TokBegin, const char *TokRangeBegin, const char *TokRangeEnd, unsigned DiagID)
Produce a diagnostic highlighting some portion of a literal.
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...
PreprocessorOptions - This class is used for passing the various options used in preprocessor initial...
bool initFromFile(StringRef filePath, DiagnosticsEngine &Diag, bool ignoreIfFilesChanged)
void forEachMapping(llvm::function_ref< void(StringRef, StringRef)> CaptureFile, llvm::function_ref< void(StringRef, const llvm::MemoryBufferRef &)> CaptureBuffer) const
Iterate through all the mappings.
bool flushToDisk(StringRef outputDir, DiagnosticsEngine &Diag)
bool flushToFile(StringRef outputPath, DiagnosticsEngine &Diag)
void remap(StringRef filePath, std::unique_ptr< llvm::MemoryBuffer > memBuf)
void clear(StringRef outputDir=StringRef())
void applyMappings(PreprocessorOptions &PPOpts) const
bool initFromDisk(StringRef outputDir, DiagnosticsEngine &Diag, bool ignoreIfFilesChanged)
bool overwriteOriginal(DiagnosticsEngine &Diag, StringRef outputDir=StringRef())
The JSON file list parser is used to communicate input to InstallAPI.
Diagnostic wrappers for TextAPI types for error reporting.