CLANG-FORMAT(1)
πΈ NAME πΈ
clang-format β bestie, it's the manual page for clang-format 19 π
β¨ DESCRIPTION β¨
OVERVIEW: it's a tool that formats C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code. yes, all of those. she's versatile like that π
So here's the vibe check on how she behaves:
- If you pass no arguments at all, she formats the code coming in from standard input and writes the result straight to standard output. π«Ά
- If you give her
<file>s, she reformats those files. - If
-iis in the mix together with<file>s, the files get edited in-place. - Otherwise, the result goes to standard output.
USAGE:
clang-format [options] [@<file>] [<file> ...]
OPTIONS:
π Clang-format options π
--Werrorβ if you set this, formatting warnings get promoted to errors. no more soft-launching your problems π--Wno-error=<value>β if you set this, she won't error out on the specified warning type.=unknownβ if you set this, unknown format options are only warned about, not errored.
This is how you enable formatting even when your config is carrying unknown (newer) options. Use with caution, bestie β 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 you don't pass this, the.clang-formatfile is searched relative to the current working directory when reading stdin. Unrecognized filenames are treated asC++. supported:- CSharp:
.cs - Java:
.java - JavaScript:
.mjs.js.ts - Json:
.json - Objective-C:
.m.mm - Proto:
.proto.protodevel - TableGen:
.td - TextProto:
.txtpb.textpb.pb.txt.textproto.asciipb - Verilog:
.sv.svh.v.vh
- CSharp:
--cursor=<uint>β the position of the cursor when invokingclang-formatfrom an editor integration. editor besties, this one's for you π§--dry-runβ if set, she does not actually make the formatting changes. just a lil preview moment π--dump-configβ dump configuration options to stdout and exit. can be used with the-styleoption.--fail-on-incomplete-formatβ if set, fail with exit code1on incomplete format.--fallback-style=<string>β the name of the predefined style used as a fallback whenclang-formatis invoked with-style=filebut can not find the.clang-formatfile to use. Defaults to'LLVM'. Use-fallback-style=noneto skip formatting.--ferror-limit=<uint>β set the maximum number ofclang-formaterrors to emit before stopping (0= no limit). Used only 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). Multiple ranges can be formatted 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, 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. nosy in the best way π
π 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 page, you ate that π this was clang-format 19, dated June 2025 β and yeah, she's lowkey iconic, no cap. go format something pretty, bestie π¦β¨
π¦ where this page comes from
- debian bookworm: clang-format-19 1:19.1.7-3~deb12u1 Β· APACHE-2-LLVM-EXCEPTIONS
- debian trixie: clang-format-19 1:19.1.7-3+b1 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms