This is an archive of the discontinued LLVM Phabricator instance.

[ODRHash] Detect duplicate `ObjCProtocolDecl` ODR mismatches during parsing.
ClosedPublic

Authored by vsapsai on Jul 21 2022, 7:57 PM.

Details

Summary

When during parsing we encountered a duplicate ObjCProtocolDecl, we
were always emitting an error. With this change we accept

  • when a previous ObjCProtocolDecl is in a hidden [sub]module;
  • parsed ObjCProtocolDecl is the same as the previous one.

And in case of mismatches we provide more detailed error messages.

rdar://93069080

Diff Detail

Event Timeline

vsapsai created this revision.Jul 21 2022, 7:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 7:57 PM
Herald added a subscriber: ributzka. · View Herald Transcript
vsapsai requested review of this revision.Jul 21 2022, 7:57 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 21 2022, 7:57 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
ChuanqiXu accepted this revision.Nov 10 2022, 6:18 PM

Although I'm not familiar with Objc, the change here looks good generally.

clang/include/clang/Sema/Sema.h
10131–10137

It looks better to add a comment for the new arg.

This revision is now accepted and ready to land.Nov 10 2022, 6:18 PM
bruno accepted this revision.Nov 10 2022, 10:47 PM

LGTM

This revision was landed with ongoing or failed builds.Nov 17 2022, 6:32 PM
This revision was automatically updated to reflect the committed changes.

Thanks for reviews! It was a long journey.

@vsapsai hi Volodymyr Sapsai , test case clang/test/Modules/hidden-duplicates.m is failing on our llvm community AIX box https://lab.llvm.org/buildbot/#/builders/214/builds/4442/steps/6/logs/FAIL__Clang__hidden-duplicates_m , it gives exit code 70 without detail error message, can you help fix it as soon as possible. Thanks

@vsapsai hi Volodymyr Sapsai , test case clang/test/Modules/hidden-duplicates.m is failing on our llvm community AIX box https://lab.llvm.org/buildbot/#/builders/214/builds/4442/steps/6/logs/FAIL__Clang__hidden-duplicates_m , it gives exit code 70 without detail error message, can you help fix it as soon as possible. Thanks

Does AIX have support for compiling Objective-C? I'm not entirely sure that's the right fix but many tests have // UNSUPPORTED: -zos, -aix, so I'm inclined to disable the test for AIX.

@vsapsai hi Volodymyr Sapsai , test case clang/test/Modules/hidden-duplicates.m is failing on our llvm community AIX box https://lab.llvm.org/buildbot/#/builders/214/builds/4442/steps/6/logs/FAIL__Clang__hidden-duplicates_m , it gives exit code 70 without detail error message, can you help fix it as soon as possible. Thanks

Does AIX have support for compiling Objective-C? I'm not entirely sure that's the right fix but many tests have // UNSUPPORTED: -zos, -aix, so I'm inclined to disable the test for AIX.

Generally, no. There is no Objective-C runtime currently available on the platform AFAIK. Committed an XFAIL for the issue here: https://reviews.llvm.org/rGb888cafcbc0a16f68bc0ebea495920b952290ea2