class Commit

Declaration

class Commit { /* full declaration omitted */ };

Declared at: clang/include/clang/Edit/Commit.h:29

Member Variables

private const clang::SourceManager& SourceMgr
private const clang::LangOptions& LangOpts
private const clang::PPConditionalDirectiveRecord* PPRec
private clang::edit::EditedSource* Editor = nullptr
private bool IsCommitable = true
private SmallVector<clang::edit::Commit::Edit, 8> CachedEdits
private llvm::BumpPtrAllocator StrAlloc

Method Overview

  • public Commit(const clang::SourceManager & SM, const clang::LangOptions & LangOpts, const clang::PPConditionalDirectiveRecord * PPRec = nullptr)
  • public Commit(clang::edit::EditedSource & Editor)
  • private void addInsert(clang::SourceLocation OrigLoc, clang::edit::FileOffset Offs, llvm::StringRef text, bool beforePreviousInsertions)
  • private void addInsertFromRange(clang::SourceLocation OrigLoc, clang::edit::FileOffset Offs, clang::edit::FileOffset RangeOffs, unsigned int RangeLen, bool beforePreviousInsertions)
  • private void addRemove(clang::SourceLocation OrigLoc, clang::edit::FileOffset Offs, unsigned int Len)
  • private bool canInsert(clang::SourceLocation loc, clang::edit::FileOffset & Offset)
  • private bool canInsertAfterToken(clang::SourceLocation loc, clang::edit::FileOffset & Offset, clang::SourceLocation & AfterLoc)
  • private bool canInsertInOffset(clang::SourceLocation OrigLoc, clang::edit::FileOffset Offs)
  • private bool canRemoveRange(clang::CharSourceRange range, clang::edit::FileOffset & Offs, unsigned int & Len)
  • private bool canReplaceText(clang::SourceLocation loc, llvm::StringRef text, clang::edit::FileOffset & Offs, unsigned int & Len)
  • private void commitInsert(clang::edit::FileOffset offset, llvm::StringRef text, bool beforePreviousInsertions)
  • private void commitRemove(clang::edit::FileOffset offset, unsigned int length)
  • public clang::edit::Commit::edit_iterator edit_begin() const
  • public clang::edit::Commit::edit_iterator edit_end() const
  • public bool insert(clang::SourceLocation loc, llvm::StringRef text, bool afterToken = false, bool beforePreviousInsertions = false)
  • public bool insertAfterToken(clang::SourceLocation loc, llvm::StringRef text, bool beforePreviousInsertions = false)
  • public bool insertBefore(clang::SourceLocation loc, llvm::StringRef text)
  • public bool insertFromRange(clang::SourceLocation loc, clang::CharSourceRange range, bool afterToken = false, bool beforePreviousInsertions = false)
  • public bool insertFromRange(clang::SourceLocation loc, clang::SourceRange TokenRange, bool afterToken = false, bool beforePreviousInsertions = false)
  • public bool insertWrap(llvm::StringRef before, clang::SourceRange TokenRange, llvm::StringRef after)
  • public bool insertWrap(llvm::StringRef before, clang::CharSourceRange range, llvm::StringRef after)
  • private bool isAtEndOfMacroExpansion(clang::SourceLocation loc, clang::SourceLocation * MacroEnd = nullptr) const
  • private bool isAtStartOfMacroExpansion(clang::SourceLocation loc, clang::SourceLocation * MacroBegin = nullptr) const
  • public bool isCommitable() const
  • public bool remove(clang::SourceRange TokenRange)
  • public bool remove(clang::CharSourceRange range)
  • public bool replace(clang::SourceRange TokenRange, llvm::StringRef text)
  • public bool replace(clang::CharSourceRange range, llvm::StringRef text)
  • public bool replaceText(clang::SourceLocation loc, llvm::StringRef text, llvm::StringRef replacementText)
  • public bool replaceWithInner(clang::SourceRange TokenRange, clang::SourceRange TokenInnerRange)
  • public bool replaceWithInner(clang::CharSourceRange range, clang::CharSourceRange innerRange)

Methods

Commit(const clang::SourceManager& SM,
       const clang::LangOptions& LangOpts,
       const clang::PPConditionalDirectiveRecord*
           PPRec = nullptr)

Declared at: clang/include/clang/Edit/Commit.h:64

Parameters

const clang::SourceManager& SM
const clang::LangOptions& LangOpts
const clang::PPConditionalDirectiveRecord* PPRec = nullptr

Commit(clang::edit::EditedSource& Editor)

Declared at: clang/include/clang/Edit/Commit.h:63

Parameters

clang::edit::EditedSource& Editor

void addInsert(clang::SourceLocation OrigLoc,
               clang::edit::FileOffset Offs,
               llvm::StringRef text,
               bool beforePreviousInsertions)

Declared at: clang/include/clang/Edit/Commit.h:125

Parameters

clang::SourceLocation OrigLoc
clang::edit::FileOffset Offs
llvm::StringRef text
bool beforePreviousInsertions

void addInsertFromRange(
    clang::SourceLocation OrigLoc,
    clang::edit::FileOffset Offs,
    clang::edit::FileOffset RangeOffs,
    unsigned int RangeLen,
    bool beforePreviousInsertions)

Declared at: clang/include/clang/Edit/Commit.h:127

Parameters

clang::SourceLocation OrigLoc
clang::edit::FileOffset Offs
clang::edit::FileOffset RangeOffs
unsigned int RangeLen
bool beforePreviousInsertions

void addRemove(clang::SourceLocation OrigLoc,
               clang::edit::FileOffset Offs,
               unsigned int Len)

Declared at: clang/include/clang/Edit/Commit.h:130

Parameters

clang::SourceLocation OrigLoc
clang::edit::FileOffset Offs
unsigned int Len

bool canInsert(clang::SourceLocation loc,
               clang::edit::FileOffset& Offset)

Declared at: clang/include/clang/Edit/Commit.h:132

Parameters

clang::SourceLocation loc
clang::edit::FileOffset& Offset

bool canInsertAfterToken(
    clang::SourceLocation loc,
    clang::edit::FileOffset& Offset,
    clang::SourceLocation& AfterLoc)

Declared at: clang/include/clang/Edit/Commit.h:133

Parameters

clang::SourceLocation loc
clang::edit::FileOffset& Offset
clang::SourceLocation& AfterLoc

bool canInsertInOffset(
    clang::SourceLocation OrigLoc,
    clang::edit::FileOffset Offs)

Declared at: clang/include/clang/Edit/Commit.h:135

Parameters

clang::SourceLocation OrigLoc
clang::edit::FileOffset Offs

bool canRemoveRange(clang::CharSourceRange range,
                    clang::edit::FileOffset& Offs,
                    unsigned int& Len)

Declared at: clang/include/clang/Edit/Commit.h:136

Parameters

clang::CharSourceRange range
clang::edit::FileOffset& Offs
unsigned int& Len

bool canReplaceText(clang::SourceLocation loc,
                    llvm::StringRef text,
                    clang::edit::FileOffset& Offs,
                    unsigned int& Len)

Declared at: clang/include/clang/Edit/Commit.h:137

Parameters

clang::SourceLocation loc
llvm::StringRef text
clang::edit::FileOffset& Offs
unsigned int& Len

void commitInsert(clang::edit::FileOffset offset,
                  llvm::StringRef text,
                  bool beforePreviousInsertions)

Declared at: clang/include/clang/Edit/Commit.h:140

Parameters

clang::edit::FileOffset offset
llvm::StringRef text
bool beforePreviousInsertions

void commitRemove(clang::edit::FileOffset offset,
                  unsigned int length)

Declared at: clang/include/clang/Edit/Commit.h:142

Parameters

clang::edit::FileOffset offset
unsigned int length

clang::edit::Commit::edit_iterator edit_begin()
    const

Declared at: clang/include/clang/Edit/Commit.h:121

clang::edit::Commit::edit_iterator edit_end()
    const

Declared at: clang/include/clang/Edit/Commit.h:122

bool insert(clang::SourceLocation loc,
            llvm::StringRef text,
            bool afterToken = false,
            bool beforePreviousInsertions = false)

Declared at: clang/include/clang/Edit/Commit.h:70

Parameters

clang::SourceLocation loc
llvm::StringRef text
bool afterToken = false
bool beforePreviousInsertions = false

bool insertAfterToken(
    clang::SourceLocation loc,
    llvm::StringRef text,
    bool beforePreviousInsertions = false)

Declared at: clang/include/clang/Edit/Commit.h:73

Parameters

clang::SourceLocation loc
llvm::StringRef text
bool beforePreviousInsertions = false

bool insertBefore(clang::SourceLocation loc,
                  llvm::StringRef text)

Declared at: clang/include/clang/Edit/Commit.h:78

Parameters

clang::SourceLocation loc
llvm::StringRef text

bool insertFromRange(
    clang::SourceLocation loc,
    clang::CharSourceRange range,
    bool afterToken = false,
    bool beforePreviousInsertions = false)

Declared at: clang/include/clang/Edit/Commit.h:83

Parameters

clang::SourceLocation loc
clang::CharSourceRange range
bool afterToken = false
bool beforePreviousInsertions = false

bool insertFromRange(
    clang::SourceLocation loc,
    clang::SourceRange TokenRange,
    bool afterToken = false,
    bool beforePreviousInsertions = false)

Declared at: clang/include/clang/Edit/Commit.h:95

Parameters

clang::SourceLocation loc
clang::SourceRange TokenRange
bool afterToken = false
bool beforePreviousInsertions = false

bool insertWrap(llvm::StringRef before,
                clang::SourceRange TokenRange,
                llvm::StringRef after)

Declared at: clang/include/clang/Edit/Commit.h:102

Parameters

llvm::StringRef before
clang::SourceRange TokenRange
llvm::StringRef after

bool insertWrap(llvm::StringRef before,
                clang::CharSourceRange range,
                llvm::StringRef after)

Declared at: clang/include/clang/Edit/Commit.h:86

Parameters

llvm::StringRef before
clang::CharSourceRange range
llvm::StringRef after

bool isAtEndOfMacroExpansion(
    clang::SourceLocation loc,
    clang::SourceLocation* MacroEnd =
        nullptr) const

Declared at: clang/include/clang/Edit/Commit.h:146

Parameters

clang::SourceLocation loc
clang::SourceLocation* MacroEnd = nullptr

bool isAtStartOfMacroExpansion(
    clang::SourceLocation loc,
    clang::SourceLocation* MacroBegin =
        nullptr) const

Declared at: clang/include/clang/Edit/Commit.h:144

Parameters

clang::SourceLocation loc
clang::SourceLocation* MacroBegin = nullptr

bool isCommitable() const

Declared at: clang/include/clang/Edit/Commit.h:68

bool remove(clang::SourceRange TokenRange)

Declared at: clang/include/clang/Edit/Commit.h:106

Parameters

clang::SourceRange TokenRange

bool remove(clang::CharSourceRange range)

Declared at: clang/include/clang/Edit/Commit.h:88

Parameters

clang::CharSourceRange range

bool replace(clang::SourceRange TokenRange,
             llvm::StringRef text)

Declared at: clang/include/clang/Edit/Commit.h:110

Parameters

clang::SourceRange TokenRange
llvm::StringRef text

bool replace(clang::CharSourceRange range,
             llvm::StringRef text)

Declared at: clang/include/clang/Edit/Commit.h:90

Parameters

clang::CharSourceRange range
llvm::StringRef text

bool replaceText(clang::SourceLocation loc,
                 llvm::StringRef text,
                 llvm::StringRef replacementText)

Declared at: clang/include/clang/Edit/Commit.h:92

Parameters

clang::SourceLocation loc
llvm::StringRef text
llvm::StringRef replacementText

bool replaceWithInner(
    clang::SourceRange TokenRange,
    clang::SourceRange TokenInnerRange)

Declared at: clang/include/clang/Edit/Commit.h:114

Parameters

clang::SourceRange TokenRange
clang::SourceRange TokenInnerRange

bool replaceWithInner(
    clang::CharSourceRange range,
    clang::CharSourceRange innerRange)

Declared at: clang/include/clang/Edit/Commit.h:91

Parameters

clang::CharSourceRange range
clang::CharSourceRange innerRange