INCLUDE-WHAT-YOU-USE(1)
π INCLUDE-WHAT-YOU-USE(1) π
okay bestie, gather round, because this is the manual page for include-what-you-use, aka the little tool that goes through your C and C++ source files and analyzes your #includes. it's giving "your header hygiene coach" and honestly? we're obsessed. π¦
β¨ NAME β¨
include-what-you-use β analyze #includes in C and C++ source files π
πΈ DESCRIPTION πΈ
here's the vibe, the whole usage situation, keep it in your notes:
USAGE: include-what-you-use [-Xiwyu --iwyu_opt]... <clang opts> <source file>
so basically you pass IWYU-specific options through with -Xiwyu, and here are the <iwyu_opts> you can specify (like, for example, -Xiwyu --verbose=3). no cap, this is the full list π
--check_also=<glob>β tells iwyu to print iwyu-violation info for all files matching the given glob pattern, on top of the default behaviour (which is reporting for the input.ccfile and its associated.hfiles). π«Ά you can pass this flag multiple times if you want to specify multiple glob patterns, she's flexible like that.--keep=<glob>β tells iwyu to always keep these includes. π and yes, this flag can also be specified multiple times to specify multiple glob patterns.--mapping_file=<filename>β gives iwyu a mapping file. that's it, that's the whole thing π--no_default_mappingsβ do not add iwyu's default mappings. bye default mappings π--pch_in_codeβ mark the first include in a translation unit as a precompiled header. use--pch_in_codeto prevent IWYU from removing necessary PCH includes, okay? π though Clang forces PCHs to be listed as prefix headers, the PCH-in-code pattern can be used with GCC and is standard practice on MSVC (e.g.stdafx.h). iconic messy cross-compiler lore fr fr.--prefix_header_includes=<value>β tells iwyu what to do with in-source includes and forward declarations involving prefix headers. so a prefix header is a file included via the command-line option-include. and if that prefix header makes an include or forward declaration obsolete, the presence of such an include can be controlled with the following values:add: new lines are added β¨keep: new lines aren't added, existing are kept intact π«Άremove: new lines aren't added, existing are removed π- default value is
add. periodt.
--transitive_includes_onlyβ do not suggest that a file addfoo.hunlessfoo.his already visible in the file's transitive includes. no sneaky invisible headers bestie π--max_line_lengthβ maximum line length for includes. note that this only affects comments and alignment thereof β the maximum line length can still be exceeded with long file names (default:80). she's trying her best, okay?? π--comment_style=<level>β set verbosity of'why'comments to one of the following values:none: do not add'why'commentsshort:'why'comments do not include namespaceslong:'why'comments include namespaces- default value is
short. π
--no_commentsβ do not add'why'comments. silent mode, mysterious queen π--update_commentsβ update and insert'why'comments, even if no#includelines need to be added or removed. glow-up your comments for no reason at all, we support it π--no_fwd_declsβ do not use forward declarations. we're going the long way, apparently πΆβοΈ--verbose=<level>β the higher the level, the more output. the more she talks, the more you learn iykyk π₯--quoted_includes_firstβ when sorting includes, place quoted ones first. quoted girls to the front π β¨--cxx17nsβ suggests the more concise syntax introduced in C++17. modern, forward-thinking, lowkey stunning π--error[=N]β exit withN(default:1) for iwyu violations. she's MAD now π€--error_always[=N]β always exit withN(default:1) (for use withmake -k). consistent drama, every single time π--debug=flag[,flag...]β debug flags (undocumented). spooky. mysterious. no notes π--regex=<dialect>β use specified regex dialect in IWYU:llvm: fast and simple (default) β‘ecmascript: slower, but more feature-complete β¨
--experimental=flag[,flag...]β enable experimental features:clang_mappings: use Clang canonical standard library mappings instead of built-in mappings π§
and in addition to IWYU-specific options, you can specify the following options without the -Xiwyu prefix π«Ά:
--helpβ prints this help and exits. she's helpful and she leaves, queen behaviour π--versionβ prints version and exits. π
β οΈ real talk though: all those--iwyu_optsneed to be sent through with-Xiwyu(except the last two,--helpand--version, which go in bare), so don't be out here typing them raw and then acting surprised when clang yells at you. π
and that's the whole page bestie, thanks for reading my manual page essay π this was include-what-you-use version 8.23-1build1, dated January 2026, written under the User Commands section of the manual β mwah, go fix your includes, ily πβ¨π¦
π¦ where this page comes from
- ubuntu resolute: iwyu 8.23-1build1 Β· U-OF-I-BSD-LIKE
- ubuntu stonking: iwyu 8.23-1build1 Β· U-OF-I-BSD-LIKE
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms