This is an archive of the discontinued LLVM Phabricator instance.

[libc++] Fixes clang-tidy plugin for clang-tidy 17.
ClosedPublic

Authored by Mordante on May 23 2023, 8:27 AM.

Details

Reviewers
philnik
Group Reviewers
Restricted Project
Commits
rG81fb5a0e1cf8: [libc++] Fixes clang-tidy plugin for clang-tidy 17.
Summary

When using with clang-tidy 17 Node.getAttrName() sometimes returns a
nullptr. This caused segfaults in the CI.

Diff Detail

Event Timeline

Mordante created this revision.May 23 2023, 8:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 8:27 AM
Mordante published this revision for review.May 23 2023, 11:20 AM
Mordante added a reviewer: philnik.
Herald added a project: Restricted Project. · View Herald TranscriptMay 23 2023, 11:20 AM
Herald added a reviewer: Restricted Project. · View Herald Transcript

Are you sure this is expected? I can't really imagine a scenario where an attribute doesn't have a name. Clang itself also seems to assume that the pointer is non-null, since it just dereferences it instantly in quite a few places.

Are you sure this is expected? I can't really imagine a scenario where an attribute doesn't have a name. Clang itself also seems to assume that the pointer is non-null, since it just dereferences it instantly in quite a few places.

I know the CI with clang-tidy 17 crashes, due to it. After this change it passed. Note the original code has a similar test at one place. I haven't checked what Clang does.

libcxx/test/tools/clang_tidy_checks/uglify_attributes.cpp
83

@philnik here the original code has a test too.

philnik accepted this revision.May 24 2023, 8:39 AM

Are you sure this is expected? I can't really imagine a scenario where an attribute doesn't have a name. Clang itself also seems to assume that the pointer is non-null, since it just dereferences it instantly in quite a few places.

I know the CI with clang-tidy 17 crashes, due to it. After this change it passed. Note the original code has a similar test at one place. I haven't checked what Clang does.

Hmm. I guess it's fine since there was a check already.

This revision is now accepted and ready to land.May 24 2023, 8:39 AM
This revision was automatically updated to reflect the committed changes.