blob: 2534ec5277d98fb37cb79537b272d83abb56787d [file] [log] [blame]
John Thompsone0756452014-01-07 15:22:08 +00001.. index:: module-map-checker
2
3================================
4Module-Map-Checker User's Manual
5================================
6
7:program:`module-map-checker` is a tool that validates a module map by
8checking that all headers in the corresponding directories are accounted for.
9
10This program uses the Clang ModuleMap class to read and parse the module
11map file. Starting at the module map file directory, or just the include
12paths, if specified, it will collect the names of all the files it
13considers headers. It then compares the headers against those referenced
14in the module map, either explicitly named, or implicitly named via an
15umbrella directory or umbrella file, as parsed by the ModuleMap object.
16If headers are found which are not referenced or covered by an umbrella
17directory or file, warning messages will be produced, and this program
18will return an error code of 1. Other errors result in an error code of 2.
19If no problems are found, an error code of 0 is returned.
20
21Note that in the case of umbrella headers, this tool invokes the compiler
22to preprocess the file, and uses a callback to collect the header files
23included by the umbrella header or any of its nested includes. If any
24front end options are needed for these compiler invocations, these
25can be included on the command line after the module map file argument.
26
27Warning message have the form::
28
29 warning: module.map does not account for file: header.h
30
31Note that for the case of the module map referencing a file that does
32not exist, the module map parser in Clang will display an error message.
33
34Getting Started
35===============
36
37To build from source:
38
391. Read `Getting Started with the LLVM System`_ and `Clang Tools
40 Documentation`_ for information on getting sources for LLVM, Clang, and
41 Clang Extra Tools.
42
432. `Getting Started with the LLVM System`_ and `Building LLVM with CMake`_ give
44 directions for how to build. With sources all checked out into the
45 right place the LLVM build will build Clang Extra Tools and their
46 dependencies automatically.
47
48 * If using CMake, you can also use the ``module-map-checker`` target to build
49 just the module-map-checker tool and its dependencies.
50
51.. _Getting Started with the LLVM System: http://llvm.org/docs/GettingStarted.html
52.. _Building LLVM with CMake: http://llvm.org/docs/CMake.html
53.. _Clang Tools Documentation: http://clang.llvm.org/docs/ClangTools.html
54
55Module-Map-Checker Usage
56========================
57
58``module-map-checker [<module-map-checker-options>] <module-map-file> [<front-end-options>...]``
59
60``<module-map-checker-options>`` is a place-holder for options
61specific to module-map-checker, which are described below in
62`Module-Map-Checker Command Line Options`.
63
64``<module-map-file>`` specifies the path of a module map
65file. The path can be relative to the current directory.
66
67``<front-end-options>`` is a place-holder for regular Clang
68front-end arguments, which must follow the <module-map-file>.
69
70Module-Map-Checker Command Line Options
71=======================================
72
73.. option:: -I(include path)
74
75 Look at headers only in this directory tree.
76 Must be a path relative to the module.map file.
77 There can be multiple ``-I`` options, for when the
78 module map covers multiple directories, and
79 excludes higher or sibling directories not
80 specified. If this option is omitted, the
81 directory containing the module-map-file is
82 the root of the header tree to be searched for
83 headers.
84
85.. option:: -dump-module-map
86
87 Dump the module map object during the check.
88 This displays the modules and headers.