This is an archive of the discontinued LLVM Phabricator instance.

[include-cleaner] Fix a crash on non-identifier-name symbols.
ClosedPublic

Authored by hokein on Mar 6 2023, 2:48 AM.

Diff Detail

Event Timeline

hokein created this revision.Mar 6 2023, 2:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 2:48 AM
hokein requested review of this revision.Mar 6 2023, 2:48 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2023, 2:48 AM
hokein added inline comments.Mar 6 2023, 2:53 AM
clang-tools-extra/include-cleaner/test/nocrash.cpp
2

I have considered to add a unittest in FindHeadersTest, but that is not trivial to do, the unittest is written based on the assumption that the captured symbol name is a simple identifier (we use the it to find the symbol based on a given text name).

Other ideas are welcome.

kadircet accepted this revision.Mar 6 2023, 4:08 AM

thanks, LGTM!

clang-tools-extra/include-cleaner/test/nocrash.cpp
2

i think this LG, any place that needs to test these APIs requires handles to the decls. So we either need to have a test that does complicated AST traversals to reach a particular node or test things through an integration test, something like this or a unittest on top of walkUsed/analyze. I don't think former is worth for a crash test and having a unittest based on walkUsed/analyze for checking a crash inside headersForSymbol is more confusing.

This revision is now accepted and ready to land.Mar 6 2023, 4:08 AM