clang 10.0.0git

Functions
EditedSource.cpp File Reference
`#include "clang/Edit/EditedSource.h"`
`#include "clang/Basic/CharInfo.h"`
`#include "clang/Basic/LLVM.h"`
`#include "clang/Basic/SourceLocation.h"`
`#include "clang/Basic/SourceManager.h"`
`#include "clang/Edit/Commit.h"`
`#include "clang/Edit/EditsReceiver.h"`
`#include "clang/Edit/FileOffset.h"`
`#include "clang/Lex/Lexer.h"`
`#include "llvm/ADT/STLExtras.h"`
`#include "llvm/ADT/SmallString.h"`
`#include "llvm/ADT/StringRef.h"`
`#include "llvm/ADT/Twine.h"`
`#include <algorithm>`
`#include <cassert>`
`#include <tuple>`
`#include <utility>`
Include dependency graph for EditedSource.cpp:

Go to the source code of this file.

## Functions
static bool | canBeJoined (char left, char right, const LangOptions &LangOpts)
static bool | canRemoveWhitespace (char left, char beforeWSpace, char right, const LangOptions &LangOpts)
| Returns true if it is ok to eliminate the trailing whitespace between the given characters. More...
static void | adjustRemoval (const SourceManager &SM, const LangOptions &LangOpts, SourceLocation Loc, FileOffset offs, unsigned &len, StringRef &text)
| Check the range that we are going to remove and: -Remove any trailing whitespace if possible. More...
static void | applyRewrite (EditsReceiver &receiver, StringRef text, FileOffset offs, unsigned len, const SourceManager &SM, const LangOptions &LangOpts, bool shouldAdjustRemovals)

## Function Documentation

## ◆ adjustRemoval()

static void adjustRemoval | ( | const SourceManager & | SM,
|  | const LangOptions & | LangOpts,
|  | SourceLocation | Loc,
|  | FileOffset | offs,
|  | unsigned & | len,
|  | StringRef & | text
| ) |  |
| static

Check the range that we are going to remove and: -Remove any trailing whitespace if possible.

-Insert a space if removing the range is going to mess up the source tokens.

Definition at line 337 of file EditedSource.cpp.

References canBeJoined(), canRemoveWhitespace(), clang::Lexer::GetBeginningOfToken(), clang::SourceManager::getBufferData(), clang::edit::FileOffset::getFID(), and clang::edit::FileOffset::getOffset().

Referenced by applyRewrite().

## ◆ applyRewrite()

static void applyRewrite | ( | EditsReceiver & | receiver,
|  | StringRef | text,
|  | FileOffset | offs,
|  | unsigned | len,
|  | const SourceManager & | SM,
|  | const LangOptions & | LangOpts,
|  | bool | shouldAdjustRemovals
| ) |  |
| static

Definition at line 382 of file EditedSource.cpp.

References adjustRemoval(), clang::CharSourceRange::getCharRange(), clang::edit::FileOffset::getFID(), clang::SourceManager::getLocForStartOfFile(), clang::SourceLocation::getLocWithOffset(), clang::edit::FileOffset::getOffset(), clang::edit::EditsReceiver::insert(), clang::FileID::isValid(), clang::transformer::range(), clang::edit::EditsReceiver::remove(), and clang::edit::EditsReceiver::replace().

Referenced by clang::edit::EditedSource::applyRewrites().

## ◆ canBeJoined()

static bool canBeJoined | ( | char | left,
|  | char | right,
|  | const LangOptions & | LangOpts
| ) |  |
| static

Definition at line 314 of file EditedSource.cpp.

References clang::Lexer::isIdentifierBodyChar().

Referenced by adjustRemoval(), and canRemoveWhitespace().

## ◆ canRemoveWhitespace()

static bool canRemoveWhitespace | ( | char | left,
|  | char | beforeWSpace,
|  | char | right,
|  | const LangOptions & | LangOpts
| ) |  |
| static

Returns true if it is ok to eliminate the trailing whitespace between the given characters.

Definition at line 323 of file EditedSource.cpp.

References canBeJoined(), and clang::isWhitespace().

Referenced by adjustRemoval().