[all-commits] [llvm/llvm-project] d9eca3: [modules] Fix tracking ObjCInterfaceType decl when...

Volodymyr Sapsai via All-commits all-commits at lists.llvm.org
Thu Oct 21 12:08:35 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: d9eca3320a4d8db11ad65229ef6f564d134fc894
      https://github.com/llvm/llvm-project/commit/d9eca3320a4d8db11ad65229ef6f564d134fc894
  Author: Volodymyr Sapsai <vsapsai at apple.com>
  Date:   2021-10-21 (Thu, 21 Oct 2021)

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

  Log Message:
  -----------
  [modules] Fix tracking ObjCInterfaceType decl when there are multiple definitions.

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.

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




More information about the All-commits mailing list