INCLUDE-WHAT-YOU-USE(1)

NAME
include-what-you-use - Analyze #includes in C and C++ source files

DESCRIPTION
USAGE: include-what-you-use [-Xiwyu --iwyu_opt]... <clang opts> <source file> Here are the <iwyu_opts> you can specify (e.g. -Xiwyu --verbose=3):

--check_also=<glob>: tells iwyu to print iwyu-violation info

    for all files matching the given glob pattern (in addition to the default of reporting for the input .cc file and its associated .h files). This flag may be specified multiple times to specify multiple glob patterns.

--keep=<glob>: tells iwyu to always keep these includes.

    This flag may be specified multiple times to specify multiple glob patterns.

--mapping_file=<filename>: gives iwyu a mapping file.

--no_default_mappings: do not add iwyu's default mappings.

--pch_in_code: mark the first include in a translation unit as a

precompiled header.
    Use --pch_in_code to prevent IWYU from

removing necessary PCH includes.
    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).

--prefix_header_includes=<value>: tells iwyu what to do with

    in-source includes and forward declarations involving prefix headers. Prefix header is a file included via command-line option -include. If prefix header makes include or forward declaration obsolete, presence of such 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'.

--transitive_includes_only: do not suggest that a file add

    foo.h unless foo.h is already visible in the file's transitive includes.

--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).

--comment_style=<level> set verbosity of 'why' comments to one

    of the following values:

none:
    do not add 'why' comments

    short: 'why' comments do not include namespaces long: 'why' comments include namespaces

    Default value is 'short'.

--no_comments: do not add 'why' comments.

--update_comments: update and insert 'why' comments, even if no

    #include lines need to be added or removed.

--no_fwd_decls: do not use forward declarations.

--verbose=<level>: the higher the level, the more output.

--quoted_includes_first: when sorting includes, place quoted

    ones first.

--cxx17ns: suggests the more concise syntax introduced in C++17

--error[=N]: exit with N (default: 1) for iwyu violations

--error_always[=N]: always exit with N (default: 1) (for use

    with 'make -k')

--debug=flag[,flag...]: debug flags (undocumented)

--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

In addition to IWYU-specific options you can specify the following options without -Xiwyu prefix:

--help: prints this help and exits.

--version: prints version and exits.