1. Jul 13, 2022
  2. Jul 12, 2022
    • Chuanqi Xu's avatar
      [AST] Accept identical TypeConstraint referring to other template · f6b0ae14
      Chuanqi Xu authored
      parameters.
      
      The current implementation to judge the similarity of TypeConstraint in
      ASTContext::isSameTemplateParameter is problematic, it couldn't handle
      the following case:
      
      ```C++
      template <__integer_like _Tp, C<_Tp> Sentinel>
      constexpr _Tp operator()(_Tp &&__t, Sentinel &&last) const {
          return __t;
      }
      ```
      
      When we see 2 such declarations from different modules, we would judge
      their similarity by `ASTContext::isSame*` methods. But problems come for
      the TypeConstraint. Originally, we would profile each argument one by
      one. But it is not right. Since the profiling result of `_Tp` would
      refer to two different template type declarations. So it would get
      different results. It is right since the `_Tp` in different modules
      refers to different declarations indeed. So the same declaration in
      different modules would meet incorrect our-checking results.
      
      It is not the thing we want. We want to know if the TypeConstraint have
      the same expression.
      
      Reviewer: vsapsai, ilya-biryukov
      
      Differential Revision: https://reviews.llvm.org/D129068
      f6b0ae14