[all-commits] [llvm/llvm-project] 367e61: [C++20] [Modules] Emit full specialization of vari...

Chuanqi Xu via All-commits all-commits at lists.llvm.org
Mon Jan 2 22:52:37 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 367e618fd605353ad77bb78f884c758948f0d573
      https://github.com/llvm/llvm-project/commit/367e618fd605353ad77bb78f884c758948f0d573
  Author: Chuanqi Xu <yedeng.yd at linux.alibaba.com>
  Date:   2023-01-03 (Tue, 03 Jan 2023)

  Changed paths:
    M clang/lib/Serialization/ASTWriterDecl.cpp
    A clang/test/Modules/pr59780.cppm

  Log Message:
  -----------
  [C++20] [Modules] Emit full specialization of variable template as available externally in importers

Closes https://github.com/llvm/llvm-project/issues/59780.

In this issue report, when we use full specialization of variable
templates in modules, we will meet the multiple definition errors.

The root cause of the problem is that when we see the full
specialization of the variable template in the importers, we will find
if it is already defined in the external sources and we failed to find
such definitions from external sources. So we generate the definition in
the current TU. We failed to find the definition in the external sources
because we restricted to not write it during writing. However, we don't
know why we restricted it and it doesn't make a lot sense to do such
restriction. Then no test fails after we remove such limitations. So
let's remove it now and add it back later if we found it is necessary
then we can add the corresponding test that time.

Note that the code is only applied to named modules and
PCHWithObjectFiles. So it won't affect the normal clang modules and
header units.




More information about the All-commits mailing list