10 #ifndef LLVM_CLANG_EDIT_EDITEDSOURCE_H 11 #define LLVM_CLANG_EDIT_EDITEDSOURCE_H 15 #include "llvm/ADT/DenseMap.h" 16 #include "llvm/ADT/StringRef.h" 17 #include "llvm/ADT/TinyPtrVector.h" 18 #include "llvm/Support/Allocator.h" 24 class PPConditionalDirectiveRecord;
39 FileEdit() : RemoveLen(0) {}
42 typedef std::map<FileOffset, FileEdit> FileEditsTy;
43 FileEditsTy FileEdits;
51 bool operator==(
const MacroArgUse &Other)
const {
52 return std::tie(Identifier, ImmediateExpansionLoc, UseLoc) ==
53 std::tie(Other.Identifier, Other.ImmediateExpansionLoc,
58 llvm::DenseMap<unsigned, SmallVector<MacroArgUse, 2>> ExpansionToArgMap;
60 CurrCommitMacroArgExps;
63 llvm::BumpPtrAllocator StrAlloc;
68 : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec), IdentTable(LangOpts),
84 StringRef
copyString(StringRef str) {
return str.copy(StrAlloc); }
89 bool beforePreviousInsertions);
92 bool beforePreviousInsertions);
97 FileEditsTy::iterator getActionForOffset(
FileOffset Offs);
100 MacroArgUse &ArgUse);
102 void startingCommit();
103 void finishedCommit();
const PPConditionalDirectiveRecord * getPPCondDirectiveRecord() const
bool operator==(CanQual< T > x, CanQual< U > y)
One of these records is kept for each identifier that is lexed.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Implements an efficient mapping from strings to IdentifierInfo nodes.
Defines the clang::IdentifierInfo, clang::IdentifierTable, and clang::Selector interfaces.
const SourceManager & getSourceManager() const
Encodes a location in the source.
Records preprocessor conditional directive regions and allows querying in which region source locatio...
const LangOptions & getLangOpts() const
StringRef copyString(StringRef str)
Dataflow Directional Tag Classes.
bool commit(const Commit &commit)
EditedSource(const SourceManager &SM, const LangOptions &LangOpts, const PPConditionalDirectiveRecord *PPRec=nullptr)
bool canInsertInOffset(SourceLocation OrigLoc, FileOffset Offs)
void applyRewrites(EditsReceiver &receiver, bool adjustRemovals=true)
This class handles loading and caching of source files into memory.