Go to the documentation of this file.
28 #include "llvm/ADT/STLExtras.h"
29 #include "llvm/Support/Debug.h"
31 #define DEBUG_TYPE "format-formatter"
38 unsigned FirstStartColumn,
unsigned NextStartColumn,
39 unsigned LastStartColumn)
41 ID(VirtualSM->get().getMainFileID()), FirstStartColumn(FirstStartColumn),
42 NextStartColumn(NextStartColumn), LastStartColumn(LastStartColumn) {
52 : Style(Style), Env(Env),
53 AffectedRangeMgr(Env.getSourceManager(), Env.getCharRanges()),
56 Env.getSourceManager().getBufferData(Env.getFileID()))) {
58 llvm::dbgs() <<
"File encoding: "
67 llvm::SpecificBumpPtrAllocator<FormatToken> Allocator;
80 for (
unsigned Run = 0, RunE =
UnwrappedLines.size(); Run + 1 != RunE; ++Run) {
81 LLVM_DEBUG(llvm::dbgs() <<
"Run " << Run <<
"...\n");
85 for (
unsigned i = 0, e =
UnwrappedLines[Run].size(); i != e; ++i) {
87 Annotator.
annotate(*AnnotatedLines.back());
90 std::pair<tooling::Replacements, unsigned> RunResult =
91 analyze(Annotator, AnnotatedLines, Lex);
94 llvm::dbgs() <<
"Replacements for run " << Run <<
":\n";
96 E = RunResult.first.end();
98 llvm::dbgs() << I->toString() <<
"\n";
101 for (
unsigned i = 0, e = AnnotatedLines.size(); i != e; ++i) {
102 delete AnnotatedLines[i];
105 Penalty += RunResult.second;
106 for (
const auto &R : RunResult.first) {
107 auto Err = Result.add(R);
116 return {Result, Penalty};
Encodes a location in the source.
Parser - This implements a parser for the C family of languages.
static CharSourceRange getCharRange(SourceRange R)
std::string toString(const til::SExpr *E)
SourceManager and necessary depdencies (e.g.
SourceLocation getLocForStartOfFile(FileID FID) const
Return the source location corresponding to the first byte of the specified file.
Dataflow Directional Tag Classes.
Implements an efficient mapping from strings to IdentifierInfo nodes.
SourceLocation getLocWithOffset(int Offset) const
Return a source location with the specified offset from this SourceLocation.