10 #ifndef LLVM_CLANG_EDIT_COMMIT_H 11 #define LLVM_CLANG_EDIT_COMMIT_H 16 #include "llvm/ADT/SmallVector.h" 17 #include "llvm/ADT/StringRef.h" 18 #include "llvm/Support/Allocator.h" 23 class PPConditionalDirectiveRecord;
58 bool IsCommitable =
true;
61 llvm::BumpPtrAllocator StrAlloc;
67 : SourceMgr(SM), LangOpts(LangOpts), PPRec(PPRec) {}
72 bool beforePreviousInsertions =
false);
75 bool beforePreviousInsertions =
false) {
76 return insert(loc, text,
true, beforePreviousInsertions);
80 return insert(loc, text,
false,
85 bool afterToken =
false,
86 bool beforePreviousInsertions =
false);
94 StringRef replacementText);
97 bool afterToken =
false,
98 bool beforePreviousInsertions =
false) {
100 afterToken, beforePreviousInsertions);
127 FileOffset Offs, StringRef text,
bool beforePreviousInsertions);
130 bool beforePreviousInsertions);
141 void commitInsert(
FileOffset offset, StringRef text,
142 bool beforePreviousInsertions);
155 #endif // LLVM_CLANG_EDIT_COMMIT_H bool insertWrap(StringRef before, CharSourceRange range, StringRef after)
static CharSourceRange getTokenRange(SourceRange R)
SmallVectorImpl< Edit >::const_iterator edit_iterator
bool insertAfterToken(SourceLocation loc, StringRef text, bool beforePreviousInsertions=false)
bool replace(SourceRange TokenRange, StringRef text)
bool insertFromRange(SourceLocation loc, CharSourceRange range, bool afterToken=false, bool beforePreviousInsertions=false)
bool insert(SourceLocation loc, StringRef text, bool afterToken=false, bool beforePreviousInsertions=false)
edit_iterator edit_end() const
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Commit(const SourceManager &SM, const LangOptions &LangOpts, const PPConditionalDirectiveRecord *PPRec=nullptr)
bool replace(CharSourceRange range, StringRef text)
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified...
CharSourceRange getFileRange(SourceManager &SM) const
Represents a character-granular source range.
edit_iterator edit_begin() const
FileOffset InsertFromRangeOffs
float __ovld __cnfn length(float p)
Return the length of vector p, i.e., sqrt(p.x2 + p.y 2 + ...)
Encodes a location in the source.
Records preprocessor conditional directive regions and allows querying in which region source locatio...
bool insertWrap(StringRef before, SourceRange TokenRange, StringRef after)
Dataflow Directional Tag Classes.
bool isCommitable() const
CharSourceRange getInsertFromRange(SourceManager &SM) const
bool replaceText(SourceLocation loc, StringRef text, StringRef replacementText)
bool insertFromRange(SourceLocation loc, SourceRange TokenRange, bool afterToken=false, bool beforePreviousInsertions=false)
Commit(EditedSource &Editor)
Defines the clang::SourceLocation class and associated facilities.
bool replaceWithInner(SourceRange TokenRange, SourceRange TokenInnerRange)
bool insertBefore(SourceLocation loc, StringRef text)
SourceLocation getFileLocation(SourceManager &SM) const
bool replaceWithInner(CharSourceRange range, CharSourceRange innerRange)
A trivial tuple used to represent a source range.
This class handles loading and caching of source files into memory.