Commit Graph

1 Commits

Author SHA1 Message Date
Jean-Philippe Gravel 6fb66575fb Add support for group/backreferences regex replacement in mapping files.
This is useful to generically remap files from one directory to another.
The following mapping would for instance map all files under the "foo/"
directory to "third_party/foo/", for instance, mapping "foo/bar.h" to
"third_party/foo/bar.h".

[ { include: ['@"(foo/.*)"', private, '"third_party/\1"', public ] } ]

This is useful for large project where different third_party libraries
are compiled together. In Chromium for instance, include paths would
look like:
 -Ithird_party -Ithird_party/v8/include

This allows code in V8 to include its own headers directly. Other
third_parties would include them via "third_party/v8/include/...".
Because files are accessible from two different paths, IWYU can't know
which should be used. Using a mapping file, adding or removing the
"third_party/v8/include" prefix where needed, resolves this problem.
2022-10-09 20:40:18 +02:00