10 #ifndef LLVM_CLANG_EDIT_EDITEDSOURCE_H 11 #define LLVM_CLANG_EDIT_EDITEDSOURCE_H 17 #include "llvm/ADT/DenseMap.h" 18 #include "llvm/ADT/SmallVector.h" 19 #include "llvm/ADT/StringRef.h" 20 #include "llvm/Support/Allocator.h" 28 class PPConditionalDirectiveRecord;
43 unsigned RemoveLen = 0;
48 using FileEditsTy = std::map<FileOffset, FileEdit>;
50 FileEditsTy FileEdits;
59 bool operator==(
const MacroArgUse &Other)
const {
60 return std::tie(Identifier, ImmediateExpansionLoc, UseLoc) ==
61 std::tie(Other.Identifier, Other.ImmediateExpansionLoc,
66 llvm::DenseMap<unsigned, SmallVector<MacroArgUse, 2>> ExpansionToArgMap;
68 CurrCommitMacroArgExps;
71 llvm::BumpPtrAllocator StrAlloc;
76 : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec), IdentTable(LangOpts) {}
92 StringRef
copyString(StringRef str) {
return str.copy(StrAlloc); }
97 bool beforePreviousInsertions);
100 bool beforePreviousInsertions);
105 FileEditsTy::iterator getActionForOffset(
FileOffset Offs);
108 MacroArgUse &ArgUse);
110 void startingCommit();
111 void finishedCommit();
118 #endif // LLVM_CLANG_EDIT_EDITEDSOURCE_H 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...
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
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)
Defines the clang::SourceLocation class and associated facilities.
This class handles loading and caching of source files into memory.