Go to the documentation of this file.
9 #ifndef LLVM_CLANG_EDIT_COMMIT_H
10 #define LLVM_CLANG_EDIT_COMMIT_H
15 #include "llvm/ADT/SmallVector.h"
16 #include "llvm/ADT/StringRef.h"
17 #include "llvm/Support/Allocator.h"
22 class PPConditionalDirectiveRecord;
57 bool IsCommitable =
true;
60 llvm::BumpPtrAllocator StrAlloc;
66 : SourceMgr(
SM), LangOpts(LangOpts), PPRec(PPRec) {}
71 bool beforePreviousInsertions =
false);
74 bool beforePreviousInsertions =
false) {
75 return insert(loc,
text,
true, beforePreviousInsertions);
84 bool afterToken =
false,
85 bool beforePreviousInsertions =
false);
93 StringRef replacementText);
96 bool afterToken =
false,
97 bool beforePreviousInsertions =
false) {
99 afterToken, beforePreviousInsertions);
129 bool beforePreviousInsertions);
141 bool beforePreviousInsertions);
154 #endif // LLVM_CLANG_EDIT_COMMIT_H
bool replace(SourceRange TokenRange, StringRef text)
A trivial tuple used to represent a source range.
bool insertWrap(StringRef before, CharSourceRange range, StringRef after)
bool insertFromRange(SourceLocation loc, CharSourceRange range, bool afterToken=false, bool beforePreviousInsertions=false)
Encodes a location in the source.
bool insert(SourceLocation loc, StringRef text, bool afterToken=false, bool beforePreviousInsertions=false)
bool replace(CharSourceRange range, StringRef text)
bool insertAfterToken(SourceLocation loc, StringRef text, bool beforePreviousInsertions=false)
This class handles loading and caching of source files into memory.
SmallVectorImpl< Edit >::const_iterator edit_iterator
CharSourceRange getInsertFromRange(SourceManager &SM) const
edit_iterator edit_end() const
float __ovld __cnfn length(float)
Return the length of vector p, i.e., sqrt(p.x2 + p.y 2 + ...)
SourceLocation getFileLocation(SourceManager &SM) const
FileOffset InsertFromRangeOffs
Commit(const SourceManager &SM, const LangOptions &LangOpts, const PPConditionalDirectiveRecord *PPRec=nullptr)
Records preprocessor conditional directive regions and allows querying in which region source locatio...
edit_iterator edit_begin() const
static CharSourceRange getTokenRange(SourceRange R)
Represents a character-granular source range.
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
bool insertWrap(StringRef before, SourceRange TokenRange, StringRef after)
bool isCommitable() const
Commit(EditedSource &Editor)
bool insertBefore(SourceLocation loc, StringRef text)
bool replaceWithInner(SourceRange TokenRange, SourceRange TokenInnerRange)
bool remove(SourceRange TokenRange)
bool insertFromRange(SourceLocation loc, SourceRange TokenRange, bool afterToken=false, bool beforePreviousInsertions=false)
CharSourceRange getFileRange(SourceManager &SM) const
bool remove(CharSourceRange range)
bool replaceWithInner(CharSourceRange range, CharSourceRange innerRange)
bool replaceText(SourceLocation loc, StringRef text, StringRef replacementText)