clang 20.0.0git
Classes | Public Types | Public Member Functions | List of all members
clang::edit::Commit Class Reference

#include "clang/Edit/Commit.h"

Classes

struct  Edit
 

Public Types

enum  EditKind { Act_Insert , Act_InsertFromRange , Act_Remove }
 
using edit_iterator = SmallVectorImpl< Edit >::const_iterator
 

Public Member Functions

 Commit (EditedSource &Editor)
 
 Commit (const SourceManager &SM, const LangOptions &LangOpts, const PPConditionalDirectiveRecord *PPRec=nullptr)
 
bool isCommitable () const
 
bool insert (SourceLocation loc, StringRef text, bool afterToken=false, bool beforePreviousInsertions=false)
 
bool insertAfterToken (SourceLocation loc, StringRef text, bool beforePreviousInsertions=false)
 
bool insertBefore (SourceLocation loc, StringRef text)
 
bool insertFromRange (SourceLocation loc, CharSourceRange range, bool afterToken=false, bool beforePreviousInsertions=false)
 
bool insertWrap (StringRef before, CharSourceRange range, StringRef after)
 
bool remove (CharSourceRange range)
 
bool replace (CharSourceRange range, StringRef text)
 
bool replaceWithInner (CharSourceRange range, CharSourceRange innerRange)
 
bool replaceText (SourceLocation loc, StringRef text, StringRef replacementText)
 
bool insertFromRange (SourceLocation loc, SourceRange TokenRange, bool afterToken=false, bool beforePreviousInsertions=false)
 
bool insertWrap (StringRef before, SourceRange TokenRange, StringRef after)
 
bool remove (SourceRange TokenRange)
 
bool replace (SourceRange TokenRange, StringRef text)
 
bool replaceWithInner (SourceRange TokenRange, SourceRange TokenInnerRange)
 
edit_iterator edit_begin () const
 
edit_iterator edit_end () const
 

Detailed Description

Definition at line 29 of file Commit.h.

Member Typedef Documentation

◆ edit_iterator

Definition at line 119 of file Commit.h.

Member Enumeration Documentation

◆ EditKind

Enumerator
Act_Insert 
Act_InsertFromRange 
Act_Remove 

Definition at line 31 of file Commit.h.

Constructor & Destructor Documentation

◆ Commit() [1/2]

Commit::Commit ( EditedSource Editor)
explicit

Definition at line 43 of file Commit.cpp.

◆ Commit() [2/2]

clang::edit::Commit::Commit ( const SourceManager SM,
const LangOptions LangOpts,
const PPConditionalDirectiveRecord PPRec = nullptr 
)
inline

Definition at line 64 of file Commit.h.

Member Function Documentation

◆ edit_begin()

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

Definition at line 121 of file Commit.h.

Referenced by applyCocoaAPICheck().

◆ edit_end()

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

Definition at line 122 of file Commit.h.

Referenced by applyCocoaAPICheck().

◆ insert()

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

◆ insertAfterToken()

bool clang::edit::Commit::insertAfterToken ( SourceLocation  loc,
StringRef  text,
bool  beforePreviousInsertions = false 
)
inline

Definition at line 73 of file Commit.h.

References insert().

Referenced by insertWrap(), rewriteToDictionaryLiteral(), and rewriteToObjCInterfaceDecl().

◆ insertBefore()

bool clang::edit::Commit::insertBefore ( SourceLocation  loc,
StringRef  text 
)
inline

◆ insertFromRange() [1/2]

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

◆ insertFromRange() [2/2]

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

Definition at line 95 of file Commit.h.

References clang::CharSourceRange::getTokenRange(), and insertFromRange().

◆ insertWrap() [1/2]

bool Commit::insertWrap ( StringRef  before,
CharSourceRange  range,
StringRef  after 
)

◆ insertWrap() [2/2]

bool clang::edit::Commit::insertWrap ( StringRef  before,
SourceRange  TokenRange,
StringRef  after 
)
inline

Definition at line 102 of file Commit.h.

References clang::CharSourceRange::getTokenRange(), and insertWrap().

◆ isCommitable()

bool clang::edit::Commit::isCommitable ( ) const
inline

Definition at line 68 of file Commit.h.

Referenced by applyCocoaAPICheck(), and clang::FixItRewriter::HandleDiagnostic().

◆ remove() [1/2]

bool Commit::remove ( CharSourceRange  range)

◆ remove() [2/2]

bool clang::edit::Commit::remove ( SourceRange  TokenRange)
inline

Definition at line 106 of file Commit.h.

References clang::CharSourceRange::getTokenRange(), and remove().

◆ replace() [1/2]

bool Commit::replace ( CharSourceRange  range,
StringRef  text 
)

◆ replace() [2/2]

bool clang::edit::Commit::replace ( SourceRange  TokenRange,
StringRef  text 
)
inline

Definition at line 110 of file Commit.h.

References clang::CharSourceRange::getTokenRange(), and replace().

◆ replaceText()

bool Commit::replaceText ( SourceLocation  loc,
StringRef  text,
StringRef  replacementText 
)

Definition at line 165 of file Commit.cpp.

◆ replaceWithInner() [1/2]

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

◆ replaceWithInner() [2/2]

bool clang::edit::Commit::replaceWithInner ( SourceRange  TokenRange,
SourceRange  TokenInnerRange 
)
inline

Definition at line 114 of file Commit.h.

References clang::CharSourceRange::getTokenRange(), and replaceWithInner().


The documentation for this class was generated from the following files: