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"
22class 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);
79 return insert(loc, text,
false,
84 bool afterToken =
false,
85 bool beforePreviousInsertions =
false);
93 StringRef replacementText);
96 bool afterToken =
false,
97 bool beforePreviousInsertions =
false) {
99 afterToken, beforePreviousInsertions);
126 FileOffset Offs, StringRef text,
bool beforePreviousInsertions);
129 bool beforePreviousInsertions);
140 void commitInsert(
FileOffset offset, StringRef text,
141 bool beforePreviousInsertions);
Forward-declares and imports various common LLVM datatypes that clang wants to use unqualified.
Defines the clang::SourceLocation class and associated facilities.
Represents a character-granular source range.
static CharSourceRange getTokenRange(SourceRange R)
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Records preprocessor conditional directive regions and allows querying in which region source locatio...
Encodes a location in the source.
This class handles loading and caching of source files into memory.
A trivial tuple used to represent a source range.
bool replaceWithInner(CharSourceRange range, CharSourceRange innerRange)
bool remove(SourceRange TokenRange)
bool insertWrap(StringRef before, CharSourceRange range, StringRef after)
bool insertFromRange(SourceLocation loc, CharSourceRange range, bool afterToken=false, bool beforePreviousInsertions=false)
bool insert(SourceLocation loc, StringRef text, bool afterToken=false, bool beforePreviousInsertions=false)
Commit(const SourceManager &SM, const LangOptions &LangOpts, const PPConditionalDirectiveRecord *PPRec=nullptr)
bool isCommitable() const
bool insertAfterToken(SourceLocation loc, StringRef text, bool beforePreviousInsertions=false)
edit_iterator edit_begin() const
SmallVectorImpl< Edit >::const_iterator edit_iterator
bool remove(CharSourceRange range)
bool insertBefore(SourceLocation loc, StringRef text)
bool insertWrap(StringRef before, SourceRange TokenRange, StringRef after)
bool replace(SourceRange TokenRange, StringRef text)
bool insertFromRange(SourceLocation loc, SourceRange TokenRange, bool afterToken=false, bool beforePreviousInsertions=false)
bool replaceWithInner(SourceRange TokenRange, SourceRange TokenInnerRange)
bool replace(CharSourceRange range, StringRef text)
edit_iterator edit_end() const
bool replaceText(SourceLocation loc, StringRef text, StringRef replacementText)
The JSON file list parser is used to communicate input to InstallAPI.
float __ovld __cnfn length(float)
Return the length of vector p, i.e., sqrt(p.x2 + p.y 2 + ...)
SourceLocation getFileLocation(SourceManager &SM) const
CharSourceRange getFileRange(SourceManager &SM) const
FileOffset InsertFromRangeOffs
CharSourceRange getInsertFromRange(SourceManager &SM) const