Lines Matching +defs:clang +defs:format
1 //===-- clang-format/ClangFormat.cpp - Clang format tool ------------------===//
10 /// This file implements a clang-format tool that automatically formats
16 #include "clang/Basic/Diagnostic.h"
17 #include "clang/Basic/DiagnosticOptions.h"
18 #include "clang/Basic/FileManager.h"
19 #include "clang/Basic/SourceManager.h"
20 #include "clang/Basic/Version.h"
21 #include "clang/Format/Format.h"
22 #include "clang/Rewrite/Core/Rewriter.h"
31 using clang::tooling::Replacements;
37 static cl::OptionCategory ClangFormatCategory("Clang-format options");
52 "-length, clang-format will format up to the end\n"
58 cl::desc("<start line>:<end line> - format a range of\n"
66 Style("style", cl::desc(clang::format::StyleOptionHelpDescription),
67 cl::init(clang::format::DefaultFormatStyle),
72 "fallback in case clang-format is invoked with\n"
73 "-style=file, but can not find the .clang-format\n"
76 cl::init(clang::format::DefaultFallbackStyle),
82 ".clang-format file.\n"
84 "If this is not passed, the .clang-format file is searched\n"
114 "clang-format from an editor integration"),
152 WarnFormat("Wclang-format-violations",
158 NoWarnFormat("Wno-clang-format-violations",
165 cl::desc("Set the maximum number of clang-format errors to emit\n"
184 "If set, unknown format options are only warned about.\n"
188 "differing format depending on an option being\n"
209 "fail-on-incomplete-format",
210 cl::desc("If set, fail with exit code 1 on incomplete format."),
217 namespace clang {
218 namespace format {
369 "code should be clang-formatted [-Wclang-format-violations]");
407 errs() << "clang-format error:" << vec << "\n";
412 static bool format(StringRef FileName, bool ErrorOnIncompleteFormat = false) {
493 // To format JSON insert a variable to trick the code into thinking its
551 } // namespace format
552 } // namespace clang
555 OS << clang::getClangToolFullVersion("clang-format") << '\n';
573 Expected<clang::format::FormatStyle> FormatStyle = clang::format::getStyle(
581 std::string Config = clang::format::configurationAsText(*FormatStyle);
587 static String IgnoreDir; // Directory of .clang-format-ignore file.
589 static SmallVector<String> Patterns; // Patterns in .clang-format-ignore file.
592 // .clang-format-ignore file based on the rules below:
598 // - A pattern is relative to the directory of the .clang-format-ignore file (or
618 append(Path, ".clang-format-ignore");
667 if (clang::format::matchFilePath(Pattern, Pathname) == !IsNegated)
682 "A tool to format C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# "
710 return clang::format::format("-", FailOnIncompleteFormat);
734 Error |= clang::format::format(FileName, FailOnIncompleteFormat);