9 #ifndef LLVM_CLANG_EDIT_EDITEDSOURCE_H 10 #define LLVM_CLANG_EDIT_EDITEDSOURCE_H 16 #include "llvm/ADT/DenseMap.h" 17 #include "llvm/ADT/SmallVector.h" 18 #include "llvm/ADT/StringRef.h" 19 #include "llvm/Support/Allocator.h" 27 class PPConditionalDirectiveRecord;
42 unsigned RemoveLen = 0;
47 using FileEditsTy = std::map<FileOffset, FileEdit>;
49 FileEditsTy FileEdits;
58 bool operator==(
const MacroArgUse &Other)
const {
59 return std::tie(Identifier, ImmediateExpansionLoc, UseLoc) ==
60 std::tie(Other.Identifier, Other.ImmediateExpansionLoc,
65 llvm::DenseMap<unsigned, SmallVector<MacroArgUse, 2>> ExpansionToArgMap;
67 CurrCommitMacroArgExps;
70 llvm::BumpPtrAllocator StrAlloc;
75 : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec), IdentTable(LangOpts) {}
91 StringRef
copyString(StringRef str) {
return str.copy(StrAlloc); }
96 bool beforePreviousInsertions);
99 bool beforePreviousInsertions);
104 FileEditsTy::iterator getActionForOffset(
FileOffset Offs);
107 MacroArgUse &ArgUse);
109 void startingCommit();
110 void finishedCommit();
117 #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.