14#ifndef LLVM_CLANG_REWRITE_CORE_REWRITER_H
15#define LLVM_CLANG_REWRITE_CORE_REWRITER_H
19#include "llvm/ADT/RewriteBuffer.h"
20#include "llvm/ADT/StringRef.h"
35 std::map<FileID, llvm::RewriteBuffer> RewriteBuffers;
67 std::map<FileID, llvm::RewriteBuffer>::const_iterator;
71 : SourceMgr(&
SM), LangOpts(&LO) {}
84 return Loc.isFileID();
90 RewriteOptions opts = RewriteOptions())
const;
92 RewriteOptions opts = RewriteOptions())
const;
117 bool InsertAfter =
true,
bool indentNewLines =
false);
143 RewriteOptions opts = RewriteOptions());
200 std::map<FileID, llvm::RewriteBuffer>::const_iterator I =
201 RewriteBuffers.find(FID);
202 return I == RewriteBuffers.end() ? nullptr : &I->second;
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)
An opaque identifier used by SourceManager which refers to a source file (MemoryBuffer) along with it...
Keeps track of the various options that can be enabled, which controls the dialect of C or C++ that i...
Rewriter - This is the main interface to the rewrite buffers.
bool InsertTextBefore(SourceLocation Loc, StringRef Str)
InsertText - Insert the specified string at the specified location in the original buffer.
std::map< FileID, llvm::RewriteBuffer >::iterator buffer_iterator
std::map< FileID, llvm::RewriteBuffer >::const_iterator const_buffer_iterator
int getRangeSize(SourceRange Range, RewriteOptions opts=RewriteOptions()) const
getRangeSize - Return the size in bytes of the specified range if they are in the same file.
void setSourceMgr(SourceManager &SM, const LangOptions &LO)
std::string getRewrittenText(SourceRange Range) const
getRewrittenText - Return the rewritten form of the text in the specified range.