John Thompson | e075645 | 2014-01-07 15:22:08 +0000 | [diff] [blame] | 1 | .. index:: module-map-checker |
| 2 | |
| 3 | ================================ |
| 4 | Module-Map-Checker User's Manual |
| 5 | ================================ |
| 6 | |
| 7 | :program:`module-map-checker` is a tool that validates a module map by |
| 8 | checking that all headers in the corresponding directories are accounted for. |
| 9 | |
| 10 | This program uses the Clang ModuleMap class to read and parse the module |
| 11 | map file. Starting at the module map file directory, or just the include |
| 12 | paths, if specified, it will collect the names of all the files it |
| 13 | considers headers. It then compares the headers against those referenced |
| 14 | in the module map, either explicitly named, or implicitly named via an |
| 15 | umbrella directory or umbrella file, as parsed by the ModuleMap object. |
| 16 | If headers are found which are not referenced or covered by an umbrella |
| 17 | directory or file, warning messages will be produced, and this program |
| 18 | will return an error code of 1. Other errors result in an error code of 2. |
| 19 | If no problems are found, an error code of 0 is returned. |
| 20 | |
| 21 | Note that in the case of umbrella headers, this tool invokes the compiler |
| 22 | to preprocess the file, and uses a callback to collect the header files |
| 23 | included by the umbrella header or any of its nested includes. If any |
| 24 | front end options are needed for these compiler invocations, these |
| 25 | can be included on the command line after the module map file argument. |
| 26 | |
| 27 | Warning message have the form:: |
| 28 | |
| 29 | warning: module.map does not account for file: header.h |
| 30 | |
| 31 | Note that for the case of the module map referencing a file that does |
| 32 | not exist, the module map parser in Clang will display an error message. |
| 33 | |
| 34 | Getting Started |
| 35 | =============== |
| 36 | |
| 37 | To build from source: |
| 38 | |
| 39 | 1. 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 | |
| 43 | 2. `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 | |
| 55 | Module-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 |
| 61 | specific 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 |
| 65 | file. The path can be relative to the current directory. |
| 66 | |
| 67 | ``<front-end-options>`` is a place-holder for regular Clang |
| 68 | front-end arguments, which must follow the <module-map-file>. |
| 69 | |
| 70 | Module-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. |