CLANG-FORMAT(1)
πΈ CLANG-FORMAT πΈ
bestie. come here. sit down. you're about to meet clang-format 22 and honestly? your codebase is gonna thank you. this is the manual page, but make it cute and make it make sense.
π NAME π
clang-format β ok so this is literally the manual page for clang-format 22. that's it. that's the name. iconic.
β¨ DESCRIPTION β¨
OVERVIEW: it's a whole tool that formats your C/C++/Java/JavaScript/JSON/Objective-C/Protobuf/C# code. like, it takes your chaotic little lines and makes them look like someone with taste touched them. π
okay here's the tea on how it actually behaves:
- give it no arguments at all? it reads the code from standard input and writes the formatted result to standard output. a little glow-up pipeline, no notes.
- give it some
<file>s? it reformats the files. - give it
-itogether with<file>s? bestie, the files get edited in-place. like, actually changed. on disk. for real. π«Ά - none of the above? the result goes to standard output. simple.
USAGE:
clang-format [options] [@<file>] [<file> ...]
π OPTIONS π
π Clang-format options π
--Werrorβ if you set this, formatting warnings get promoted to actual errors. no more soft-launching problems. π--Wno-error=<value>β if you set this, it won't error out on the warning type you specify. pick your battles, queen.=unknownβ if set, unknown format options are only warned about.- this is the one you use when you wanna enable formatting even though your configuration contains unknown (newer) options. β οΈ but use with caution, because this might lead to dramatically differing format depending on whether an option is supported or not. so dramatic. be careful bestie.
--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 it, the.clang-formatfile is searched relative to the current working directory when reading stdin. unrecognized filenames get treated as C++. supported:CSharp:.csJava:.javaJavaScript:.js.mjs.cjs.tsJSON:.json.ipynbObjective-C:.m.mmProto:.proto.protodevelTableGen:.tdTextProto:.txtpb.textpb.pb.txt.textproto.asciipbVerilog:.sv.svh.v.vh
--cursor=<uint>β the position of the cursor when you're invokingclang-formatfrom an editor integration. hi editor besties π--dry-runβ if set, it does not actually make the formatting changes. it's the window-shopping of formatting. ποΈ--dump-configβ dumps configuration options to stdout and exits. can be used with the-styleoption.--fail-on-incomplete-formatβ if set, it fails with exit code 1 on an incomplete format. harsh but honest.--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'. pass-fallback-style=noneto skip formatting entirely. π--ferror-limit=<uint>β sets the maximum number of clang-format errors 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. a whole roster. π-iβ inplace edit the<file>s, if specified. this one writes, fr fr.--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β an alias for--dry-run. same vibe, shorter name. β¨--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β outputs 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>β sets the 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, it shows the list of processed files. nosy (affectionate).
π 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.
and that's the whole thing, bestie. go forth and format. your indentation is gonna be so slay. π β¨
this was the clang-format 22 manual page, dated September 2026 β mwah, take care of her, and take care of your code. ππ¦π
π¦ where this page comes from
- ubuntu stonking: clang-format-22 1:22.1.8-1ubuntu1 Β· APACHE-2-LLVM-EXCEPTIONS
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms