10 #ifndef LLVM_CLANG_EDIT_EDITEDSOURCE_H
11 #define LLVM_CLANG_EDIT_EDITEDSOURCE_H
14 #include "llvm/ADT/DenseMap.h"
15 #include "llvm/ADT/StringRef.h"
16 #include "llvm/Support/Allocator.h"
21 class PPConditionalDirectiveRecord;
36 FileEdit() : RemoveLen(0) {}
39 typedef std::map<FileOffset, FileEdit> FileEditsTy;
40 FileEditsTy FileEdits;
42 llvm::DenseMap<unsigned, SourceLocation> ExpansionToArgMap;
44 llvm::BumpPtrAllocator StrAlloc;
49 : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec),
66 char *buf = StrAlloc.Allocate<
char>(str.size());
67 std::memcpy(buf, str.data(), str.size());
68 return StringRef(buf, str.size());
74 bool beforePreviousInsertions);
77 bool beforePreviousInsertions);
82 FileEditsTy::iterator getActionForOffset(
FileOffset Offs);
void applyRewrites(EditsReceiver &receiver)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
const SourceManager & getSourceManager() const
Encodes a location in the source. The SourceManager can decode this to get at the full include stack...
Records preprocessor conditional directive regions and allows querying in which region source locatio...
const PPConditionalDirectiveRecord * getPPCondDirectiveRecord() const
StringRef copyString(StringRef str)
bool commit(const Commit &commit)
EditedSource(const SourceManager &SM, const LangOptions &LangOpts, const PPConditionalDirectiveRecord *PPRec=nullptr)
bool canInsertInOffset(SourceLocation OrigLoc, FileOffset Offs)
This class handles loading and caching of source files into memory.
const LangOptions & getLangOpts() const