[all-commits] [llvm/llvm-project] 42f87b: [Sema] Return primary merged decl as canonical for...

Ilya Biryukov via All-commits all-commits at lists.llvm.org
Wed Jul 27 03:31:51 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 42f87bb62d0719848842da60d2a8180b9e4d7c52
      https://github.com/llvm/llvm-project/commit/42f87bb62d0719848842da60d2a8180b9e4d7c52
  Author: Ilya Biryukov <ibiryukov at google.com>
  Date:   2022-07-27 (Wed, 27 Jul 2022)

  Changed paths:
    M clang/include/clang/AST/DeclTemplate.h
    M clang/lib/Sema/SemaTemplate.cpp
    M clang/test/Modules/merge-concepts.cpp

  Log Message:
  -----------
  [Sema] Return primary merged decl as canonical for concepts

Otherwise we get invalid results for ODR checks. See changed test for an
example: despite the fact that we merge the first concept, its **uses**
were considered different by `Profile`, leading to redefinition errors.

After this change, canonical decl for a concept can come from a
different module and may not be visible. This behavior looks suspicious,
but does not break any tests. We might want to add a mechanism to make
the canonical concept declaration visible if we find code that relies on
this invariant.

Additionally make sure we always merge with the canonical declaration to
avoid chains of merged concepts being reported as redefinitions. An
example was added to the test.

Also change the order of includes in the test. Importing a moduralized
header before its textual part causes the include guard macro to be
exported and the corresponding `#include` becomes a no-op.

Reviewed By: ChuanqiXu

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




More information about the All-commits mailing list