[all-commits] [llvm/llvm-project] f5ba3d: [clang] Fix computeTypeLinkageInfo for dependent m...

Andrew Savonichev via All-commits all-commits at lists.llvm.org
Sun Apr 27 23:51:16 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: f5ba3d0c6d413e46fa962be80cfb37857e35b9ab
      https://github.com/llvm/llvm-project/commit/f5ba3d0c6d413e46fa962be80cfb37857e35b9ab
  Author: Andrew Savonichev <andrew.savonichev at gmail.com>
  Date:   2025-04-28 (Mon, 28 Apr 2025)

  Changed paths:
    M clang/lib/AST/Type.cpp
    M clang/test/CodeGenCXX/visibility.cpp

  Log Message:
  -----------
  [clang] Fix computeTypeLinkageInfo for dependent member pointers (#136689)

MemberPointerType may refer to a dependent class (qualifier), for
which getMostRecentCXXRecordDecl returns NULL. It seems that the
compiler never executed this code path before patch #136128 where the
issue was reported.

LIT tests 74 and 75 are reduced from Chromium and LLVM libc test
harness as reported in #136128.

Function member (test74):

    MemberPointerType 'type-parameter-0-0 (type-parameter-0-1::*)(void)' dependent
    |-TemplateTypeParmType 'type-parameter-0-1' dependent depth 0 index 1
    `-FunctionProtoType 'type-parameter-0-0 (void)' dependent cdecl
      `-TemplateTypeParmType 'type-parameter-0-0' dependent depth 0 index 0

Template parameter (test75):

    MemberPointerType 'type-parameter-0-1 type-parameter-0-0::*' dependent
    |-TemplateTypeParmType 'type-parameter-0-0' dependent depth 0 index 0
    `-TemplateTypeParmType 'type-parameter-0-1' dependent depth 0 index 1


  Commit: dae63e2c0ff1b7d64e186fe72e06a80ef895402c
      https://github.com/llvm/llvm-project/commit/dae63e2c0ff1b7d64e186fe72e06a80ef895402c
  Author: Andrew Savonichev <andrew.savonichev at gmail.com>
  Date:   2025-04-28 (Mon, 28 Apr 2025)

  Changed paths:
    M clang/docs/ReleaseNotes.rst
    M clang/lib/AST/Decl.cpp
    M clang/test/CodeGenCXX/visibility.cpp

  Log Message:
  -----------
  Reland [clang] Handle instantiated members to determine visibility (#136128) (#136689)

As reported in issue #103477, visibility of instantiated member
functions used to be ignored when calculating visibility of a
specialization.

This patch modifies `getLVForClassMember` to look up for a source
template for an instantiated member, and changes `mergeTemplateLV` to
apply it.

A similar issue was reported in #31462, but it seems that `extern`
declaration with visibility prevents the function from being emitted
as hidden. This behavior seems correct, even though GCC emits it as
with default visibility instead.

Both tests from #103477 and #31462 are added as LIT tests `test72` and
`test73` respectively.


Compare: https://github.com/llvm/llvm-project/compare/0cd3fd4c5c63...dae63e2c0ff1

To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list