This is an archive of the discontinued LLVM Phabricator instance.

[include-cleaner] Ignore builtin symbols in the WalkAST.
ClosedPublic

Authored by hokein on Mar 30 2023, 3:49 AM.

Details

Summary

There is no need to add headers for builtin symbols.

Additionally, there is a bonus benefit which help eliminate some bugs -- builtin
functions are modeled as implicit FunctionDecls in the clang AST, which results in
them being treated as normal FunctionDecls in the implementation of the include-cleaner
(going through the path: ast-node -> decl -> source location -> header).
And, the source location of these built-in symbols' AST nodes is not precise (e.g. points to the first call site),
which leads to subtle behavior that inserts a header of the call site.

Diff Detail

Event Timeline

hokein created this revision.Mar 30 2023, 3:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2023, 3:49 AM
hokein requested review of this revision.Mar 30 2023, 3:49 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 30 2023, 3:49 AM
kadircet accepted this revision.Mar 30 2023, 3:58 AM
This revision is now accepted and ready to land.Mar 30 2023, 3:58 AM
This revision was landed with ongoing or failed builds.Mar 30 2023, 4:47 AM
This revision was automatically updated to reflect the committed changes.