This is an archive of the discontinued LLVM Phabricator instance.

[Serialization] Don't warn when a deserialized category is equivalent to an existing one.
ClosedPublic

Authored by vsapsai on Feb 15 2023, 5:06 PM.

Details

Summary

A single class allows multiple categories to be defined for it. But if
two of such categories have the same name, we emit a warning. It's not a
hard error but a good indication of a potential mistake.

With modules, we can end up with the same category in different modules.
Diagnosing such a situation has little value as the categories in
different modules are equivalent and don't reflect the usage of the same
name for different purposes. When we deserialize a duplicate category,
compare it to an existing one and warn only when the new one is
different.

rdar://104582081

Diff Detail

Event Timeline

vsapsai created this revision.Feb 15 2023, 5:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2023, 5:06 PM
Herald added a subscriber: ributzka. · View Herald Transcript
vsapsai requested review of this revision.Feb 15 2023, 5:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 15 2023, 5:06 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
vsapsai added inline comments.Feb 15 2023, 5:08 PM
clang/lib/Serialization/ASTReaderDecl.cpp
4188

Decided to use StructuralEquivalenceContext here because we already use it to compare ObjCCategoryDecl in ASTReader.cpp.

ChuanqiXu accepted this revision.Feb 16 2023, 11:26 PM
This revision is now accepted and ready to land.Feb 16 2023, 11:26 PM

Thanks for the review!

This revision was landed with ongoing or failed builds.Feb 22 2023, 11:07 AM
This revision was automatically updated to reflect the committed changes.