https://github.com/jcsxky created
https://github.com/llvm/llvm-project/pull/74919
Skip checking `TemplateTypeParmDecl ` in `VisitTypeAliasTemplateDecl`. [Fix
this crash](https://github.com/llvm/llvm-project/issues/74765)
>From b3c28d66efb98dff8b8f879bda92341bf62f45d3 Mon Sep 17 00:00:00 2001
F
llvmbot wrote:
@llvm/pr-subscribers-clang
Author: Qizhi Hu (jcsxky)
Changes
Skip checking `TemplateTypeParmDecl ` in `VisitTypeAliasTemplateDecl`. [Fix
this crash](https://github.com/llvm/llvm-project/issues/74765)
---
Full diff: https://github.com/llvm/llvm-project/pull/74919.diff
2 F
https://github.com/jcsxky updated
https://github.com/llvm/llvm-project/pull/74919
>From e656aa2a3850f845987bb0ddc56b308d22d2dafd Mon Sep 17 00:00:00 2001
From: huqizhi
Date: Sat, 9 Dec 2023 12:00:02 +0800
Subject: [PATCH] [clang][ASTImporter] skip TemplateTypeParmDecl in
VisitTypeAliasTemplate
balazske wrote:
The problem may be related to the fact that template parameter declarations can
have the `TranslationUnitDecl` as parent until the template (with these
parameters) is finally created. In the temporary phase the object
(`TemplateTypeParmDecl`) is found with lookup if it has the
balazske wrote:
The `VisitTypeAliasTemplateDecl` function should be re-designed to check for
structural equivalence at import. The following test does not pass because an
existing `TypeAliasTemplateDecl` declaration with the same name is always found
and returned, without check for structural
jcsxky wrote:
> The `VisitTypeAliasTemplateDecl` function should be re-designed to check for
> structural equivalence at import. The following test does not pass because an
> existing `TypeAliasTemplateDecl` declaration with the same name is always
> found and returned, without check for struc
jcsxky wrote:
> The problem may be related to the fact that template parameter declarations
> can have the `TranslationUnitDecl` as parent until the template (with these
> parameters) is finally created. In the temporary phase the object
> (`TemplateTypeParmDecl`) is found with lookup if it ha
balazske wrote:
`VisitTypeAliasTemplateDecl` looks wrong and some fix should be made, this PR
is good for the fix. This import function is different from the others because
`ConflictingDecls` is populated when an object with different type is found,
but this is the correct way. I think that `T
balazske wrote:
This code for the loop in `VisitTypeAliasTemplateDecl` should work:
```
for (auto *FoundDecl : FoundDecls) {
if (!FoundDecl->isInIdentifierNamespace(IDNS))
continue;
if (auto *FoundAlias = dyn_cast(FoundDecl)) {
if (IsStructuralMatch(D, FoundAlias))
@@ -9284,6 +9284,29 @@ TEST_P(ASTImporterOptionSpecificTestBase,
// EXPECT_EQ(ToF1Imported->getPreviousDecl(), ToF1);
}
+TEST_P(ASTImporterOptionSpecificTestBase, ImportTypeAliasTemplateDecl) {
balazske wrote:
I like better names for the test
(`ImportTypeA
https://github.com/jcsxky updated
https://github.com/llvm/llvm-project/pull/74919
>From e4e981ed4f545f3dd4cc709bab30468a8ceb3962 Mon Sep 17 00:00:00 2001
From: huqizhi
Date: Sat, 9 Dec 2023 12:00:02 +0800
Subject: [PATCH] [clang][ASTImporter] skip TemplateTypeParmDecl in
VisitTypeAliasTemplate
https://github.com/jcsxky updated
https://github.com/llvm/llvm-project/pull/74919
>From a2dcc7f471237e78f374c204216c6574059aa950 Mon Sep 17 00:00:00 2001
From: huqizhi
Date: Sat, 9 Dec 2023 12:00:02 +0800
Subject: [PATCH] [clang][ASTImporter] skip TemplateTypeParmDecl in
VisitTypeAliasTemplate
jcsxky wrote:
> The `VisitTypeAliasTemplateDecl` function should be re-designed to check for
> structural equivalence at import. The following test does not pass because an
> existing `TypeAliasTemplateDecl` declaration with the same name is always
> found and returned, without check for struc
balazske wrote:
>
> Is import of `Callable` should be failed? I compiled this code
>
> ```c++
> struct S;
> template
> using Callable = S;
> template
> using Callable = S;
> ```
>
> and clang report an error.
Yes the test was not exact, with the new code this import should fail.
https://gi
@@ -1977,6 +1977,22 @@ static bool
IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
D2->getTemplatedDecl()->getType());
}
+static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
+
https://github.com/jcsxky updated
https://github.com/llvm/llvm-project/pull/74919
>From 583cbd47533ff1aa71874c502affc44ce5b5c107 Mon Sep 17 00:00:00 2001
From: huqizhi
Date: Sat, 9 Dec 2023 12:00:02 +0800
Subject: [PATCH] [clang][ASTImporter] skip TemplateTypeParmDecl in
VisitTypeAliasTemplate
https://github.com/balazske approved this pull request.
https://github.com/llvm/llvm-project/pull/74919
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
https://github.com/jcsxky closed https://github.com/llvm/llvm-project/pull/74919
___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
18 matches
Mail list logo