clang API Documentation
#include <Commit.h>
Classes | |
struct | Edit |
Public Types | |
enum | EditKind { Act_Insert, Act_InsertFromRange, Act_Remove } |
typedef SmallVectorImpl< Edit > ::const_iterator | edit_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 |
typedef SmallVectorImpl<Edit>::const_iterator clang::edit::Commit::edit_iterator |
Commit::Commit | ( | EditedSource & | Editor | ) | [explicit] |
Definition at line 38 of file Commit.cpp.
clang::edit::Commit::Commit | ( | const SourceManager & | SM, |
const LangOptions & | LangOpts, | ||
const PPConditionalDirectiveRecord * | PPRec = nullptr |
||
) | [inline] |
edit_iterator clang::edit::Commit::edit_begin | ( | ) | const [inline] |
Definition at line 110 of file Commit.h.
Referenced by applyCocoaAPICheck(), and clang::edit::EditedSource::commit().
edit_iterator clang::edit::Commit::edit_end | ( | ) | const [inline] |
Definition at line 111 of file Commit.h.
Referenced by applyCocoaAPICheck(), and clang::edit::EditedSource::commit().
bool Commit::insert | ( | SourceLocation | loc, |
StringRef | text, | ||
bool | afterToken = false , |
||
bool | beforePreviousInsertions = false |
||
) |
Definition at line 43 of file Commit.cpp.
Referenced by applyEditsToTemp(), doRewriteToUTF8StringBoxedExpressionHelper(), clang::FixItRewriter::HandleDiagnostic(), insertAfterToken(), insertBefore(), insertWrap(), mergeFixits(), rewriteToBoolLiteral(), rewriteToCharLiteral(), and rewriteToNumberLiteral().
bool clang::edit::Commit::insertAfterToken | ( | SourceLocation | loc, |
StringRef | text, | ||
bool | beforePreviousInsertions = false |
||
) | [inline] |
Definition at line 69 of file Commit.h.
References insert().
Referenced by insertWrap(), rewriteToDictionaryLiteral(), and rewriteToObjCInterfaceDecl().
bool clang::edit::Commit::insertBefore | ( | SourceLocation | loc, |
StringRef | text | ||
) | [inline] |
Definition at line 73 of file Commit.h.
References insert().
Referenced by doRewriteToUTF8StringBoxedExpressionHelper(), objectifyExpr(), rewriteToDictionaryLiteral(), rewriteToDictionarySubscriptSet(), and rewriteToNumericBoxedExpression().
bool Commit::insertFromRange | ( | SourceLocation | loc, |
CharSourceRange | range, | ||
bool | afterToken = false , |
||
bool | beforePreviousInsertions = false |
||
) |
Definition at line 59 of file Commit.cpp.
References clang::PPConditionalDirectiveRecord::areInDifferentConditionalDirectiveRegion(), and clang::CharSourceRange::getBegin().
Referenced by clang::FixItRewriter::HandleDiagnostic(), insertFromRange(), mergeFixits(), rewriteToDictionaryLiteral(), rewriteToDictionarySubscriptSet(), and rewriteToNSEnumDecl().
bool clang::edit::Commit::insertFromRange | ( | SourceLocation | loc, |
SourceRange | TokenRange, | ||
bool | afterToken = false , |
||
bool | beforePreviousInsertions = false |
||
) | [inline] |
Definition at line 89 of file Commit.h.
References clang::CharSourceRange::getTokenRange(), and insertFromRange().
bool Commit::insertWrap | ( | StringRef | before, |
CharSourceRange | range, | ||
StringRef | after | ||
) |
Definition at line 98 of file Commit.cpp.
References clang::CharSourceRange::getBegin(), clang::CharSourceRange::getEnd(), insert(), insertAfterToken(), and clang::CharSourceRange::isTokenRange().
Referenced by doRewriteToUTF8StringBoxedExpressionHelper(), insertWrap(), maybePutParensOnReceiver(), objectifyExpr(), rewriteToArrayLiteral(), rewriteToArraySubscriptSet(), rewriteToDictionaryLiteral(), rewriteToNumericBoxedExpression(), and rewriteToSubscriptGetCommon().
bool clang::edit::Commit::insertWrap | ( | StringRef | before, |
SourceRange | TokenRange, | ||
StringRef | after | ||
) | [inline] |
Definition at line 95 of file Commit.h.
References clang::CharSourceRange::getTokenRange(), and insertWrap().
bool clang::edit::Commit::isCommitable | ( | ) | const [inline] |
Definition at line 65 of file Commit.h.
Referenced by applyCocoaAPICheck(), clang::edit::EditedSource::commit(), and clang::FixItRewriter::HandleDiagnostic().
bool Commit::remove | ( | CharSourceRange | range | ) |
Definition at line 86 of file Commit.cpp.
References clang::CharSourceRange::getBegin().
Referenced by applyEditsToTemp(), clang::FixItRewriter::HandleDiagnostic(), mergeFixits(), rewriteToDictionaryLiteral(), rewriteToNSEnumDecl(), rewriteToNSMacroDecl(), and rewriteToObjCProperty().
bool clang::edit::Commit::remove | ( | SourceRange | TokenRange | ) | [inline] |
Definition at line 98 of file Commit.h.
References clang::CharSourceRange::getTokenRange().
bool Commit::replace | ( | CharSourceRange | range, |
StringRef | text | ||
) |
Definition at line 111 of file Commit.cpp.
References clang::CharSourceRange::getBegin(), and clang::comments::tok::text.
Referenced by applyEditsToTemp(), clang::FixItRewriter::HandleDiagnostic(), mergeFixits(), replace(), ReplaceWithClasstype(), ReplaceWithInstancetype(), rewriteToArrayLiteral(), rewriteToDictionaryLiteral(), rewriteToNSEnumDecl(), rewriteToNSMacroDecl(), and rewriteToObjCProperty().
bool clang::edit::Commit::replace | ( | SourceRange | TokenRange, |
StringRef | text | ||
) | [inline] |
Definition at line 101 of file Commit.h.
References clang::CharSourceRange::getTokenRange(), and replace().
bool Commit::replaceText | ( | SourceLocation | loc, |
StringRef | text, | ||
StringRef | replacementText | ||
) |
Definition at line 160 of file Commit.cpp.
bool Commit::replaceWithInner | ( | CharSourceRange | range, |
CharSourceRange | innerRange | ||
) |
Definition at line 127 of file Commit.cpp.
References clang::CharSourceRange::getBegin(), clang::CharSourceRange::getEnd(), clang::edit::FileOffset::getFID(), clang::edit::FileOffset::getOffset(), and clang::edit::FileOffset::getWithOffset().
Referenced by doRewriteToUTF8StringBoxedExpressionHelper(), replaceWithInner(), clang::edit::rewriteObjCRedundantCallWithLiteral(), rewriteToArrayLiteral(), rewriteToArraySubscriptSet(), rewriteToBoolLiteral(), rewriteToCharLiteral(), rewriteToDictionaryLiteral(), rewriteToDictionarySubscriptSet(), rewriteToNumberLiteral(), rewriteToNumericBoxedExpression(), and rewriteToSubscriptGetCommon().
bool clang::edit::Commit::replaceWithInner | ( | SourceRange | TokenRange, |
SourceRange | TokenInnerRange | ||
) | [inline] |
Definition at line 104 of file Commit.h.
References clang::CharSourceRange::getTokenRange(), and replaceWithInner().