[PATCH] D110452: [modules] Fix tracking ObjCInterfaceType decl when there are multiple definitions.

Volodymyr Sapsai via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 24 15:59:23 PDT 2021


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

With the old approach we were updating `ObjCInterfaceType.Decl` to the
last encountered definition. But during loading modules
`ASTDeclReader::VisitObjCInterfaceDecl` keeps the *first* encountered
definition. So with multiple definitions imported there would be a
disagreement between expected definition in `ObjCInterfaceType.Decl` and
actual definition `ObjCInterfaceDecl::getDefinition` which can lead to
incorrect diagnostic.

Fix by not tracking definition in `ObjCInterfaceType` explicitly but by
getting it from redeclaration chain.

Partially reverted 919fc50034b44c48aae8b80283f253ec2ee17f45 keeping the
modified test case as the correct behavior is achieved in a different
way.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D110452

Files:
  clang/include/clang/AST/Type.h
  clang/lib/AST/DeclObjC.cpp
  clang/lib/AST/Type.cpp
  clang/lib/Sema/SemaLookup.cpp
  clang/test/Modules/decldef.mm
  clang/test/Modules/interface-diagnose-missing-import.m

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110452.374978.patch
Type: text/x-patch
Size: 5609 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20210924/04ec5743/attachment-0001.bin>


More information about the cfe-commits mailing list