CLANG-FORMAT(1)
π NAME π
okay bestie, welcome to clang-format β this is the manual page for clang-format 17 β¨
π¦ DESCRIPTION π¦
OVERVIEW: it's a tool that formats C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code. the way it justβ¦ tidies your whole life up π
So here's the vibe check on how it behaves, no cap:
- If you pass no arguments at all, it formats the code coming in from standard input and writes the result straight to standard output.
- If you give it
<file>s, it reformats those files. - If
-iis specified together with<file>s, the files get edited in-place π - Otherwise, the result just gets written to standard output.
USAGE:
clang-format [options] [<file> ...]
π OPTIONS π
β¨ Clang-format options β¨
--Werrorβ if you set this, formatting warnings get promoted to full-on errors π€--Wno-error=<value>β if you set this, it won't error out on the specified warning type.=unknownβ if you set this, unknown format options are only warned about, not errored. This one lets you keep formatting even when your configuration contains unknown (newer) options. Use with caution, bestie, because this might lead to dramatically differing format depending on whether an option is supported or not. π
--assume-filename=<string>β sets the filename used to determine the language and to find the.clang-formatfile. Only used when reading from stdin. If this isn't passed, the.clang-formatfile is searched relative to the current working directory when reading stdin. Unrecognized filenames get treated asC++. Here's what's supported:- CSharp:
.cs - Java:
.java - JavaScript:
.mjs.js.ts - Json:
.json - Objective-C:
.m.mm - Proto:
.proto.protodevel - TableGen:
.td - TextProto:
.textpb.pb.txt.textproto.asciipb - Verilog:
.sv.svh.v.vh
- CSharp:
--cursor=<uint>β the position of the cursor when you're invokingclang-formatfrom an editor integration π±οΈ--dry-runβ if you set this, it does not actually make the formatting changes (a little preview moment, iconic)--dump-configβ dumps configuration options to stdout and exits. Can be used with the-styleoption.--fallback-style=<string>β the name of the predefined style used as a fallback in caseclang-formatis invoked with-style=file, but can't find the.clang-formatfile to use. Defaults to'LLVM'. Use-fallback-style=noneto skip formatting entirely.--ferror-limit=<uint>β sets the maximum number ofclang-formaterrors to emit before stopping (0= no limit). Only used with--dry-runor-n.--files=<filename>β a file containing a list of files to process, one per line π-iβ inplace edit<file>s, if specified.--length=<uint>β format a range of this length (in bytes). You can format multiple ranges by specifying several-offsetand-lengthpairs. When only a single-offsetis specified without-length,clang-formatwill format up to the end of the file. Can only be used with one input file.--lines=<string>β<start line>:<end line>β format a range of lines (both 1-based). Multiple ranges can be formatted by specifying several-linesarguments. Can't be used with-offsetand-length. Can only be used with one input file.-nβ alias for--dry-run--offset=<uint>β format a range starting at this byte offset. Multiple ranges can be formatted by specifying several-offsetand-lengthpairs. Can only be used with one input file.--output-replacements-xmlβ output replacements as XML.--qualifier-alignment=<string>β if set, overrides the qualifier alignment style determined by theQualifierAlignmentstyle flag--sort-includesβ if set, overrides the include sorting behavior determined by theSortIncludesstyle flag--style=<string>β set coding style.<string>can be:- A preset:
LLVM,GNU,Google,Chromium,Microsoft,Mozilla,WebKit. 'file'to load style configuration from a.clang-formatfile in one of the parent directories of the source file (for stdin, see--assume-filename). If no.clang-formatfile is found, it falls back to--fallback-style.--style=fileis the default.'file:<format_file_path>'to explicitly specify the configuration file."{key: value, ...}"to set specific parameters, e.g.:
- A preset:
--style="{BasedOnStyle: llvm, IndentWidth: 8}"
--verboseβ if set, shows the list of processed files π
π Generic Options π
--helpβ display available options (--help-hiddenfor more)--help-listβ display list of available options (--help-list-hiddenfor more)--versionβ display the version of this program
okay that's the whole thing, you're soooo ready π«Ά this was clang-format 17, dated June 2025, and it's giving main character energy fr fr. go format something gorgeous bestie, mwah πβ¨π
π¦ where this page comes from
- debian trixie: clang-format-17 1:17.0.6-22+b2 Β· APACHE-2-LLVM-EXCEPTIONS
- ubuntu questing: clang-format-17 1:17.0.6-22build1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms