This is an archive of the discontinued LLVM Phabricator instance.

[include-cleaner] Only ignore builtins without a header
ClosedPublic

Authored by kadircet on Apr 3 2023, 8:48 AM.

Details

Summary

Certain standard library functions (e.g. std::move) are also implemented
as builtins. This patch moves filtering logic to the symbol->header
mapping phase to rather generate these references without any providers
only when we don't have a mapping.
That way we can also map them to header names mentioned in the builtin
mappings.

Diff Detail

Event Timeline

kadircet created this revision.Apr 3 2023, 8:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2023, 8:48 AM
kadircet requested review of this revision.Apr 3 2023, 8:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 3 2023, 8:48 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
hokein accepted this revision.Apr 4 2023, 4:26 AM

Thanks. I was surprised to see that some standard library symbols are treated as builtin symbols.

I think the current approach is better (e.g. clangd's hover on __builtin_popcount() will not give some arbitrary header providers).

clang-tools-extra/include-cleaner/lib/FindHeaders.cpp
169

I think it would be clearer if we move this FIXME after the following if branch.

This revision is now accepted and ready to land.Apr 4 2023, 4:26 AM
This revision was automatically updated to reflect the committed changes.