[PATCH] D124286: [modules] Allow parsing a duplicate Obj-C interface if a previous one comes from a hidden [sub]module.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 22 11:35:17 PDT 2022


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

Instead of emitting a redefinition error, check that definitions are
equivalent and allow such scenario. As an implementation detail we use
the previous decl to avoid disrupting existing canonical decl. And to
avoid multiple definitions in redeclaration chain we just drop the new
definition after checking equivalence.

This patch covers only duplicates encountered during parsing. We can
encounter duplicates also during deserialization but that's responsibility of
ASTReaderDecl.

rdar://82908223


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124286

Files:
  clang/include/clang/AST/DeclObjC.h
  clang/include/clang/Sema/Sema.h
  clang/lib/AST/DeclObjC.cpp
  clang/lib/Parse/ParseObjc.cpp
  clang/lib/Sema/SemaDeclObjC.cpp
  clang/test/Modules/hidden-duplicates.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124286.424549.patch
Type: text/x-patch
Size: 7849 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220422/909d4c09/attachment-0001.bin>


More information about the cfe-commits mailing list