[clang-tools-extra] [clang-include-cleaner] Add --mapping-file support for IWYU .imp mapping files. (PR #195987)
Kim Gräsman via cfe-commits
cfe-commits at lists.llvm.org
Sat Oct 3 05:20:26 PDT 2026
================
@@ -254,6 +255,28 @@ llvm::SmallVector<Header> headersForSymbol(const Symbol &S,
for (auto &Loc : locateSymbol(S, PP.getLangOpts()))
Headers.append(applyHints(findHeaders(Loc, SM, PI), Loc.Hint));
}
+
+ // Apply external symbol mappings from mapping files. We check both the
+ // simple (unqualified) name and, for declarations, the fully-qualified name.
+ if (PI) {
+ auto AddSymbolMapping = [&](llvm::StringRef Name) {
----------------
kimgr wrote:
Just a heads-up that IWYU now supports function overloads and template specializations as well:
* https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md#overloaded-functions
* https://github.com/include-what-you-use/include-what-you-use/blob/master/docs/IWYUMappings.md#overloaded-functions
So if you're planning to consume IWYU .imp files, you may see records with more type decorations.
https://github.com/llvm/llvm-project/pull/195987
More information about the cfe-commits
mailing list