diff --git a/bin/iwyu.py b/bin/iwyu.py index 10928b60..15cd81a2 100755 --- a/bin/iwyu.py +++ b/bin/iwyu.py @@ -112,6 +112,15 @@ def parse_args(args): action='store', default='.iwyu_ignore', ) + parser.add_argument( + '-I', + '--include', + dest='include_dirs', + metavar='', + help= + """Add to the list of directories that will be searched for header files.""", + action='append', + ) parser.add_argument( 'targets', metavar="", @@ -256,6 +265,8 @@ def main(): ] # Include plugin source dirs for plugins that depend on other plugins: includes += glob.glob(os.path.join(kaleidoscope_dir, 'plugins', '*', 'src')) + # Include dirs specified on the command line: + includes += map(os.path.abspath, opts.include_dirs) clang_opts += ['-I' + _ for _ in includes] # ----------------------------------------------------------------------