The current WPD system is opt-in on a per-file basis with -fvisibility=hidden or on the entire LTO unit with --lto-whole-program-visibility. For types that are known to be in prebuilt native binaries there's no good way to exclude them outside of selectively removing -fvisibility=hidden or enumerating all their devirt sites with -mllvm -wholeprogramdevirt-skip=.
The idea behind -funknown-vtable-visibility-filepaths is that the interface between our built from source LTO unit files and the native binaries are header files packaged alongside the native binaries that are usually located in specific directories (e.g. third-party). Identifying these types automatically and excluding them from participating in WPD is a lightweight solution to enabling WPD correctly in these scenarios without any additional changes.
Ultimately, we're aiming for a more robust checked solution but this provides an on-ramp to evaluate and iterate on WPD.
Testing:
ninja check-all
large internal services at Meta that links against native binaries runs correctly with WPD enabled
Pattern string doesn't seem to be used anywhere, can we simplify this using llvm::Regex instead of RegexWithPattern?