[clang] [libcxx] [clang] Preserve Qualifiers and type sugar in TemplateNames (PR #93433)

Qizhi Hu via cfe-commits cfe-commits at lists.llvm.org
Thu May 30 01:02:27 PDT 2024


jcsxky wrote:

@mizvekov After I apply you changes in this patch, https://github.com/llvm/llvm-project/issues/91677 is still crash(although it makes sense with `-ast-dump` option). I put it below for explanation clearly:
```cpp
template <typename> struct t1 {
  template <typename>
  struct t2 {};
};

template <typename T>
t1<T>::template t2<T> f1();

void f2() {
  f1<bool>();
}
```

The reason seems that we transform `TemplateDecl` to the original one and do nothing and then crash in codegen stage. For `t1<T>::t2<T>`, we have transformed qualifier(`t1<T>`) in `TransformElaboratedType`. But, we transform qualifier in `TransformTemplateName` for `t2<T>` again because of transforming `TransformTemplateSpecializationType`. This leads to the  transformation of the `TemplateDecl` as I described in the beginning.
I think we can reuse the transformed qualifier(`t1<T>`) in `TransformElaboratedType` and this is what I did in https://github.com/llvm/llvm-project/pull/93411. Could you please take another look?

https://github.com/llvm/llvm-project/pull/93433


More information about the cfe-commits mailing list