[PATCH] D138630: [modules] Fix marking `ObjCMethodDecl::isOverriding` when there a no overrides.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 23 18:04:58 PST 2022


vsapsai created this revision.
vsapsai added reviewers: egorzhdan, akyrtzi.
Herald added a subscriber: ributzka.
Herald added a project: All.
vsapsai requested review of this revision.
Herald added a project: clang.

Incorrect `isOverriding` flag triggers the assertion
`!Overridden.empty()` in `ObjCMethodDecl::getOverriddenMethods` when a
method is marked as overriding but we cannot find any overrides.

When a method is declared in a category and defined in implementation,
we don't treat it as an override because it is the same method with
a separate declaration and a definition. But with modules we can find
a method declaration both in a modular category and a non-modular category
with different memory addresses. Thus we erroneously conclude the method
is overriding. Fix by comparing canonical declarations that are the same
for equal entities coming from different modules.

rdar://92845511


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138630

Files:
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/test/Modules/override.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D138630.477664.patch
Type: text/x-patch
Size: 4186 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221124/48de4732/attachment.bin>


More information about the cfe-commits mailing list