[all-commits] [llvm/llvm-project] 74f1c9: [C++20] [Modules] Ask for definition before callin...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Wed Jun 3 02:20:04 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 74f1c9417e916aed314fd429ce2faee49668ffa6
      https://github.com/llvm/llvm-project/commit/74f1c9417e916aed314fd429ce2faee49668ffa6
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2026-06-03 (Wed, 03 Jun 2026)

  Changed paths:
    M clang/lib/AST/ASTContext.cpp
    A clang/test/Modules/pr195905.cppm

  Log Message:
  -----------
  [C++20] [Modules] Ask for definition before calling isInlineDefinitionExternallyVisible (#201291)

Close https://github.com/llvm/llvm-project/issues/195905

The root cause of the problem is, after decl merging, one of the
destructor for `base` (see test case) is chosen, and its body is not
deserialized for performance as we alreday see its body in current TU.
And then, the code call
FunctionDecl::isInlineDefinitionExternallyVisible from the destructor
without a serialized body, but
FunctionDecl::isInlineDefinitionExternallyVisible's implementation
requires to see a body. Then assertion failed.

Decl merging and function decl merging is common. We can't always make
sure we find the definition without checking. It is much more
fundamental. So the PR doesn't try to touch the decl merging mechanism
or how we handle the result of lookups.

We tried to fix the issue at the calling point to make sure we have a
definition for isInlineDefinitionExternallyVisible. Other use of
isInlineDefinitionExternallyVisible does the similar thing.



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