ΒΆtooling::Replacements reformat(
    const clang::format::FormatStyle& Style,
    llvm::StringRef Code,
    ArrayRef<tooling::Range> Ranges,
    llvm::StringRef FileName = "<stdin>",
    clang::format::FormattingAttemptStatus*
        Status = nullptr)

Description

Reformats the given \p Ranges in \p Code. Each range is extended on either end to its next bigger logic unit, i.e. everything that might influence its formatting or might be influenced by its formatting. Returns the ``Replacements`` necessary to make all \p Ranges comply with\p Style. If ``Status`` is non-null, its value will be populated with the status of this formatting attempt. See \c FormattingAttemptStatus.

Declared at: clang/include/clang/Format/Format.h:4164

Parameters

const clang::format::FormatStyle& Style
llvm::StringRef Code
ArrayRef<tooling::Range> Ranges
llvm::StringRef FileName = "<stdin>"
clang::format::FormattingAttemptStatus* Status = nullptr