[clang-tools-extra] [include-cleaner] Handle symbols from system headers. (PR #66089)
kadir çetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Wed Oct 18 03:20:58 PDT 2023
================
@@ -188,6 +290,20 @@ llvm::SmallVector<Hinted<Header>> findHeaders(const SymbolLocation &Loc,
OptionalFileEntryRef FE = SM.getFileEntryRefForID(FID);
if (!FE)
return {};
+
+ if (SrcMgr::isSystem(
+ SM.getSLocEntry(FID).getFile().getFileCharacteristic())) {
+ if (auto MappingHeader = SystemIncludeMap::get().mapHeader(FE->getName());
+ !MappingHeader.empty()) {
+ for (auto &Header : MappingHeader)
+ Results.emplace_back(Header, Hints::PublicHeader);
+ assert(!Results.empty());
+ Results.front().Hint |= Hints::PreferredHeader;
+ // FIXME: should we include the original header as well?
----------------
kadircet wrote:
yes, i think we should treat these similar to IWYU private -> public mappings.
https://github.com/llvm/llvm-project/pull/66089
More information about the cfe-commits
mailing list