Allow specification of additional include dirs on command line

This allows `bin/iwyu.py` to get library dirs other than the ones for
Kaleidoscope when running on files in `testing`, without risk of collisions when
running on Kaleidoscope itself.

Signed-off-by: Michael Richters <gedankenexperimenter@gmail.com>
pull/1162/head
Michael Richters 3 years ago
parent 4af5d6fc46
commit 21d78160f4
No known key found for this signature in database
GPG Key ID: 1288FD13E4EEF0C0

@ -112,6 +112,15 @@ def parse_args(args):
action='store',
default='.iwyu_ignore',
)
parser.add_argument(
'-I',
'--include',
dest='include_dirs',
metavar='<dir>',
help=
"""Add <dir> to the list of directories that will be searched for header files.""",
action='append',
)
parser.add_argument(
'targets',
metavar="<target>",
@ -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]
# ----------------------------------------------------------------------

Loading…
Cancel
Save