[all-commits] [llvm/llvm-project] 0314ba: [modules] Fix marking `ObjCMethodDecl::isOverridin...

Volodymyr Sapsai via All-commits all-commits at lists.llvm.org
Thu Nov 24 14:26:47 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 0314ba3acbabd8dc6d39b6d49798d22b6dc33802
      https://github.com/llvm/llvm-project/commit/0314ba3acbabd8dc6d39b6d49798d22b6dc33802
  Author: Volodymyr Sapsai <vsapsai at apple.com>
  Date:   2022-11-24 (Thu, 24 Nov 2022)

  Changed paths:
    M clang/lib/Sema/SemaDeclObjC.cpp
    A clang/test/Modules/override.m

  Log Message:
  -----------
  [modules] Fix marking `ObjCMethodDecl::isOverriding` when there are no overrides.

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

Differential Revision: https://reviews.llvm.org/D138630




More information about the All-commits mailing list