Skip to content

[clang] fix structural comparison for dependent class member pointer #133343

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025

Conversation

mizvekov
Copy link
Contributor

@mizvekov mizvekov commented Mar 27, 2025

Fixes a regression introduced in #130537 and reported here #133144

This fixes a crash in ASTStructuralEquivalence where the non-null precondition for IsStructurallyEquivalent would be violated, when comparing member pointers with a dependent class.

This also drive-by fixes the ast node traverser for member pointers so it doesn't traverse into the qualifier in case it's not a type, or the class declaration in case it would be equivalent to what the qualifier refers.

This avoids printing of <<<NULL>>> on the text node dumper, which is redundant.

No release notes since the regression was never released.

Fixes #133144

Fixes a regression introduced in #130537
and reported here #133144

This fixes a crash in ASTStructuralEquivalence where
the non-null precondition for IsStructurallyEquivalent
would be violated, when comparing member pointers with a dependent
class.

This also drive-by fixes the ast node traverser for member pointers
so it doesn't traverse into the qualifier in case it's not a type,
or the class declaration in case there is none.

This avoids printing of `<<<NULL>>>` on the text node dumper,
which is redundant.

No release notes since the regression was never released.

Fixes #133144
@mizvekov mizvekov self-assigned this Mar 27, 2025
@mizvekov mizvekov changed the title [clang] fix structural comparison dependent class member pointer [clang] fix structural comparison for dependent class member pointer Mar 27, 2025
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Mar 27, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 27, 2025

@llvm/pr-subscribers-clang

Author: Matheus Izvekov (mizvekov)

Changes

Fixes a regression introduced in #130537 and reported here #133144

This fixes a crash in ASTStructuralEquivalence where the non-null precondition for IsStructurallyEquivalent would be violated, when comparing member pointers with a dependent class.

This also drive-by fixes the ast node traverser for member pointers so it doesn't traverse into the qualifier in case it's not a type, or the class declaration in case there is none.

This avoids printing of &lt;&lt;&lt;NULL&gt;&gt;&gt; on the text node dumper, which is redundant.

No release notes since the regression was never released.

Fixes #133144


Patch is 28.94 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/133343.diff

5 Files Affected:

  • (modified) clang/include/clang/AST/ASTNodeTraverser.h (+7-2)
  • (modified) clang/lib/AST/ASTStructuralEquivalence.cpp (+5-3)
  • (modified) clang/test/AST/ast-dump-template-json-win32-mangler-crash.cpp (-3)
  • (modified) clang/test/AST/ast-dump-templates.cpp (+369-6)
  • (modified) clang/test/AST/ast-dump-types-json.cpp (-304)
diff --git a/clang/include/clang/AST/ASTNodeTraverser.h b/clang/include/clang/AST/ASTNodeTraverser.h
index f557555e96e59..83a6b77704f34 100644
--- a/clang/include/clang/AST/ASTNodeTraverser.h
+++ b/clang/include/clang/AST/ASTNodeTraverser.h
@@ -394,8 +394,13 @@ class ASTNodeTraverser
   }
   void VisitMemberPointerType(const MemberPointerType *T) {
     // FIXME: Provide a NestedNameSpecifier visitor.
-    Visit(T->getQualifier()->getAsType());
-    Visit(T->getMostRecentCXXRecordDecl());
+    NestedNameSpecifier *Qualifier = T->getQualifier();
+    if (NestedNameSpecifier::SpecifierKind K = Qualifier->getKind();
+        K == NestedNameSpecifier::TypeSpec ||
+        K == NestedNameSpecifier::TypeSpecWithTemplate)
+      Visit(Qualifier->getAsType());
+    if (T->isSugared())
+      Visit(T->getMostRecentCXXRecordDecl()->getTypeForDecl());
     Visit(T->getPointeeType());
   }
   void VisitArrayType(const ArrayType *T) { Visit(T->getElementType()); }
diff --git a/clang/lib/AST/ASTStructuralEquivalence.cpp b/clang/lib/AST/ASTStructuralEquivalence.cpp
index 2c2c8fd677500..a4349bdaaf682 100644
--- a/clang/lib/AST/ASTStructuralEquivalence.cpp
+++ b/clang/lib/AST/ASTStructuralEquivalence.cpp
@@ -897,9 +897,11 @@ static bool IsStructurallyEquivalent(StructuralEquivalenceContext &Context,
     if (!IsStructurallyEquivalent(Context, MemPtr1->getQualifier(),
                                   MemPtr2->getQualifier()))
       return false;
-    if (!IsStructurallyEquivalent(Context,
-                                  MemPtr1->getMostRecentCXXRecordDecl(),
-                                  MemPtr2->getMostRecentCXXRecordDecl()))
+    CXXRecordDecl *D1 = MemPtr1->getMostRecentCXXRecordDecl(),
+                  *D2 = MemPtr2->getMostRecentCXXRecordDecl();
+    if (D1 == D2)
+      break;
+    if (!D1 || !D2 || !IsStructurallyEquivalent(Context, D1, D2))
       return false;
     break;
   }
diff --git a/clang/test/AST/ast-dump-template-json-win32-mangler-crash.cpp b/clang/test/AST/ast-dump-template-json-win32-mangler-crash.cpp
index 9f0d3efb6277e..b80c1e1d77140 100644
--- a/clang/test/AST/ast-dump-template-json-win32-mangler-crash.cpp
+++ b/clang/test/AST/ast-dump-template-json-win32-mangler-crash.cpp
@@ -2452,9 +2452,6 @@ int main()
 // CHECK-NEXT:          }
 // CHECK-NEXT:         },
 // CHECK-NEXT:         {
-// CHECK-NEXT:          "id": "0x0"
-// CHECK-NEXT:         },
-// CHECK-NEXT:         {
 // CHECK-NEXT:          "id": "0x{{.*}}",
 // CHECK-NEXT:          "kind": "TemplateTypeParmType",
 // CHECK-NEXT:          "type": {
diff --git a/clang/test/AST/ast-dump-templates.cpp b/clang/test/AST/ast-dump-templates.cpp
index 0e0fa73871bb7..79572f5103bde 100644
--- a/clang/test/AST/ast-dump-templates.cpp
+++ b/clang/test/AST/ast-dump-templates.cpp
@@ -154,10 +154,30 @@ namespace TestMemberPointerPartialSpec {
 // DUMP-NEXT:  |-TemplateArgument type 'type-parameter-0-0 type-parameter-0-1::*'
 // DUMP-NEXT:  | `-MemberPointerType {{.+}} 'type-parameter-0-0 type-parameter-0-1::*' dependent
 // DUMP-NEXT:  |   |-TemplateTypeParmType {{.+}} 'type-parameter-0-1' dependent depth 0 index 1
-// DUMP-NEXT:  |   |-<<<NULL>>>
 // DUMP-NEXT:  |   `-TemplateTypeParmType {{.+}} 'type-parameter-0-0' dependent depth 0 index 0
 } // namespace TestMemberPointerPartialSpec
 
+namespace TestDependentMemberPointer {
+  template <class U> struct A {
+    using X = int U::*;
+    using Y = int U::test::*;
+    using Z = int U::template V<int>::*;
+  };
+// DUMP-LABEL: NamespaceDecl {{.+}} TestDependentMemberPointer{{$}}
+// DUMP:       |-TypeAliasDecl {{.+}} X 'int U::*'{{$}}
+// DUMP-NEXT:  | `-MemberPointerType {{.+}} 'int U::*' dependent
+// DUMP-NEXT:  |   |-TemplateTypeParmType {{.+}} 'U' dependent depth 0 index 0
+// DUMP-NEXT:  |   | `-TemplateTypeParm {{.+}} 'U'
+// DUMP-NEXT:  |   `-BuiltinType {{.+}} 'int'
+// DUMP-NEXT:  |-TypeAliasDecl {{.+}} Y 'int U::test::*'{{$}}
+// DUMP-NEXT:  | `-MemberPointerType {{.+}} 'int U::test::*' dependent
+// DUMP-NEXT:  |   `-BuiltinType {{.+}} 'int'
+// DUMP-NEXT:  `-TypeAliasDecl {{.+}} Z 'int U::template V<int>::*'{{$}}
+// DUMP-NEXT:    `-MemberPointerType {{.+}} 'int U::template V<int>::*' dependent
+// DUMP-NEXT:      |-DependentTemplateSpecializationType {{.+}} 'U::template V<int>' dependent
+// DUMP-NEXT:      `-BuiltinType {{.+}} 'int'
+} // namespoace TestDependentMemberPointer
+
 // NOTE: CHECK lines have been autogenerated by gen_ast_dump_json_test.py
 
 
@@ -6345,8 +6365,8 @@ namespace TestMemberPointerPartialSpec {
 // JSON-NEXT:      "tokLen": 9
 // JSON-NEXT:     },
 // JSON-NEXT:     "end": {
-// JSON-NEXT:      "offset": 5335,
-// JSON-NEXT:      "line": 159,
+// JSON-NEXT:      "offset": 5303,
+// JSON-NEXT:      "line": 158,
 // JSON-NEXT:      "col": 1,
 // JSON-NEXT:      "tokLen": 1
 // JSON-NEXT:     }
@@ -6480,9 +6500,6 @@ namespace TestMemberPointerPartialSpec {
 // JSON-NEXT:            }
 // JSON-NEXT:           },
 // JSON-NEXT:           {
-// JSON-NEXT:            "id": "0x0"
-// JSON-NEXT:           },
-// JSON-NEXT:           {
 // JSON-NEXT:            "id": "0x{{.*}}",
 // JSON-NEXT:            "kind": "TemplateTypeParmType",
 // JSON-NEXT:            "type": {
@@ -6554,6 +6571,352 @@ namespace TestMemberPointerPartialSpec {
 // JSON-NEXT:      ]
 // JSON-NEXT:     }
 // JSON-NEXT:    ]
+// JSON-NEXT:   },
+// JSON-NEXT:   {
+// JSON-NEXT:    "id": "0x{{.*}}",
+// JSON-NEXT:    "kind": "NamespaceDecl",
+// JSON-NEXT:    "loc": {
+// JSON-NEXT:     "offset": 5358,
+// JSON-NEXT:     "line": 160,
+// JSON-NEXT:     "col": 11,
+// JSON-NEXT:     "tokLen": 26
+// JSON-NEXT:    },
+// JSON-NEXT:    "range": {
+// JSON-NEXT:     "begin": {
+// JSON-NEXT:      "offset": 5348,
+// JSON-NEXT:      "col": 1,
+// JSON-NEXT:      "tokLen": 9
+// JSON-NEXT:     },
+// JSON-NEXT:     "end": {
+// JSON-NEXT:      "offset": 6359,
+// JSON-NEXT:      "line": 179,
+// JSON-NEXT:      "col": 1,
+// JSON-NEXT:      "tokLen": 1
+// JSON-NEXT:     }
+// JSON-NEXT:    },
+// JSON-NEXT:    "name": "TestDependentMemberPointer",
+// JSON-NEXT:    "inner": [
+// JSON-NEXT:     {
+// JSON-NEXT:      "id": "0x{{.*}}",
+// JSON-NEXT:      "kind": "ClassTemplateDecl",
+// JSON-NEXT:      "loc": {
+// JSON-NEXT:       "offset": 5415,
+// JSON-NEXT:       "line": 161,
+// JSON-NEXT:       "col": 29,
+// JSON-NEXT:       "tokLen": 1
+// JSON-NEXT:      },
+// JSON-NEXT:      "range": {
+// JSON-NEXT:       "begin": {
+// JSON-NEXT:        "offset": 5389,
+// JSON-NEXT:        "col": 3,
+// JSON-NEXT:        "tokLen": 8
+// JSON-NEXT:       },
+// JSON-NEXT:       "end": {
+// JSON-NEXT:        "offset": 5516,
+// JSON-NEXT:        "line": 165,
+// JSON-NEXT:        "col": 3,
+// JSON-NEXT:        "tokLen": 1
+// JSON-NEXT:       }
+// JSON-NEXT:      },
+// JSON-NEXT:      "name": "A",
+// JSON-NEXT:      "inner": [
+// JSON-NEXT:       {
+// JSON-NEXT:        "id": "0x{{.*}}",
+// JSON-NEXT:        "kind": "TemplateTypeParmDecl",
+// JSON-NEXT:        "loc": {
+// JSON-NEXT:         "offset": 5405,
+// JSON-NEXT:         "line": 161,
+// JSON-NEXT:         "col": 19,
+// JSON-NEXT:         "tokLen": 1
+// JSON-NEXT:        },
+// JSON-NEXT:        "range": {
+// JSON-NEXT:         "begin": {
+// JSON-NEXT:          "offset": 5399,
+// JSON-NEXT:          "col": 13,
+// JSON-NEXT:          "tokLen": 5
+// JSON-NEXT:         },
+// JSON-NEXT:         "end": {
+// JSON-NEXT:          "offset": 5405,
+// JSON-NEXT:          "col": 19,
+// JSON-NEXT:          "tokLen": 1
+// JSON-NEXT:         }
+// JSON-NEXT:        },
+// JSON-NEXT:        "name": "U",
+// JSON-NEXT:        "tagUsed": "class",
+// JSON-NEXT:        "depth": 0,
+// JSON-NEXT:        "index": 0
+// JSON-NEXT:       },
+// JSON-NEXT:       {
+// JSON-NEXT:        "id": "0x{{.*}}",
+// JSON-NEXT:        "kind": "CXXRecordDecl",
+// JSON-NEXT:        "loc": {
+// JSON-NEXT:         "offset": 5415,
+// JSON-NEXT:         "col": 29,
+// JSON-NEXT:         "tokLen": 1
+// JSON-NEXT:        },
+// JSON-NEXT:        "range": {
+// JSON-NEXT:         "begin": {
+// JSON-NEXT:          "offset": 5408,
+// JSON-NEXT:          "col": 22,
+// JSON-NEXT:          "tokLen": 6
+// JSON-NEXT:         },
+// JSON-NEXT:         "end": {
+// JSON-NEXT:          "offset": 5516,
+// JSON-NEXT:          "line": 165,
+// JSON-NEXT:          "col": 3,
+// JSON-NEXT:          "tokLen": 1
+// JSON-NEXT:         }
+// JSON-NEXT:        },
+// JSON-NEXT:        "name": "A",
+// JSON-NEXT:        "tagUsed": "struct",
+// JSON-NEXT:        "completeDefinition": true,
+// JSON-NEXT:        "definitionData": {
+// JSON-NEXT:         "canConstDefaultInit": true,
+// JSON-NEXT:         "copyAssign": {
+// JSON-NEXT:          "hasConstParam": true,
+// JSON-NEXT:          "implicitHasConstParam": true,
+// JSON-NEXT:          "needsImplicit": true,
+// JSON-NEXT:          "simple": true,
+// JSON-NEXT:          "trivial": true
+// JSON-NEXT:         },
+// JSON-NEXT:         "copyCtor": {
+// JSON-NEXT:          "hasConstParam": true,
+// JSON-NEXT:          "implicitHasConstParam": true,
+// JSON-NEXT:          "needsImplicit": true,
+// JSON-NEXT:          "simple": true,
+// JSON-NEXT:          "trivial": true
+// JSON-NEXT:         },
+// JSON-NEXT:         "defaultCtor": {
+// JSON-NEXT:          "defaultedIsConstexpr": true,
+// JSON-NEXT:          "exists": true,
+// JSON-NEXT:          "isConstexpr": true,
+// JSON-NEXT:          "needsImplicit": true,
+// JSON-NEXT:          "trivial": true
+// JSON-NEXT:         },
+// JSON-NEXT:         "dtor": {
+// JSON-NEXT:          "irrelevant": true,
+// JSON-NEXT:          "needsImplicit": true,
+// JSON-NEXT:          "simple": true,
+// JSON-NEXT:          "trivial": true
+// JSON-NEXT:         },
+// JSON-NEXT:         "hasConstexprNonCopyMoveConstructor": true,
+// JSON-NEXT:         "isAggregate": true,
+// JSON-NEXT:         "isEmpty": true,
+// JSON-NEXT:         "isLiteral": true,
+// JSON-NEXT:         "isPOD": true,
+// JSON-NEXT:         "isStandardLayout": true,
+// JSON-NEXT:         "isTrivial": true,
+// JSON-NEXT:         "isTriviallyCopyable": true,
+// JSON-NEXT:         "moveAssign": {
+// JSON-NEXT:          "exists": true,
+// JSON-NEXT:          "needsImplicit": true,
+// JSON-NEXT:          "simple": true,
+// JSON-NEXT:          "trivial": true
+// JSON-NEXT:         },
+// JSON-NEXT:         "moveCtor": {
+// JSON-NEXT:          "exists": true,
+// JSON-NEXT:          "needsImplicit": true,
+// JSON-NEXT:          "simple": true,
+// JSON-NEXT:          "trivial": true
+// JSON-NEXT:         }
+// JSON-NEXT:        },
+// JSON-NEXT:        "inner": [
+// JSON-NEXT:         {
+// JSON-NEXT:          "id": "0x{{.*}}",
+// JSON-NEXT:          "kind": "CXXRecordDecl",
+// JSON-NEXT:          "loc": {
+// JSON-NEXT:           "offset": 5415,
+// JSON-NEXT:           "line": 161,
+// JSON-NEXT:           "col": 29,
+// JSON-NEXT:           "tokLen": 1
+// JSON-NEXT:          },
+// JSON-NEXT:          "range": {
+// JSON-NEXT:           "begin": {
+// JSON-NEXT:            "offset": 5408,
+// JSON-NEXT:            "col": 22,
+// JSON-NEXT:            "tokLen": 6
+// JSON-NEXT:           },
+// JSON-NEXT:           "end": {
+// JSON-NEXT:            "offset": 5415,
+// JSON-NEXT:            "col": 29,
+// JSON-NEXT:            "tokLen": 1
+// JSON-NEXT:           }
+// JSON-NEXT:          },
+// JSON-NEXT:          "isImplicit": true,
+// JSON-NEXT:          "name": "A",
+// JSON-NEXT:          "tagUsed": "struct"
+// JSON-NEXT:         },
+// JSON-NEXT:         {
+// JSON-NEXT:          "id": "0x{{.*}}",
+// JSON-NEXT:          "kind": "TypeAliasDecl",
+// JSON-NEXT:          "loc": {
+// JSON-NEXT:           "offset": 5429,
+// JSON-NEXT:           "line": 162,
+// JSON-NEXT:           "col": 11,
+// JSON-NEXT:           "tokLen": 1
+// JSON-NEXT:          },
+// JSON-NEXT:          "range": {
+// JSON-NEXT:           "begin": {
+// JSON-NEXT:            "offset": 5423,
+// JSON-NEXT:            "col": 5,
+// JSON-NEXT:            "tokLen": 5
+// JSON-NEXT:           },
+// JSON-NEXT:           "end": {
+// JSON-NEXT:            "offset": 5440,
+// JSON-NEXT:            "col": 22,
+// JSON-NEXT:            "tokLen": 1
+// JSON-NEXT:           }
+// JSON-NEXT:          },
+// JSON-NEXT:          "name": "X",
+// JSON-NEXT:          "type": {
+// JSON-NEXT:           "qualType": "int U::*"
+// JSON-NEXT:          },
+// JSON-NEXT:          "inner": [
+// JSON-NEXT:           {
+// JSON-NEXT:            "id": "0x{{.*}}",
+// JSON-NEXT:            "kind": "MemberPointerType",
+// JSON-NEXT:            "type": {
+// JSON-NEXT:             "qualType": "int U::*"
+// JSON-NEXT:            },
+// JSON-NEXT:            "isDependent": true,
+// JSON-NEXT:            "isInstantiationDependent": true,
+// JSON-NEXT:            "isData": true,
+// JSON-NEXT:            "inner": [
+// JSON-NEXT:             {
+// JSON-NEXT:              "id": "0x{{.*}}",
+// JSON-NEXT:              "kind": "TemplateTypeParmType",
+// JSON-NEXT:              "type": {
+// JSON-NEXT:               "qualType": "U"
+// JSON-NEXT:              },
+// JSON-NEXT:              "isDependent": true,
+// JSON-NEXT:              "isInstantiationDependent": true,
+// JSON-NEXT:              "depth": 0,
+// JSON-NEXT:              "index": 0,
+// JSON-NEXT:              "decl": {
+// JSON-NEXT:               "id": "0x{{.*}}",
+// JSON-NEXT:               "kind": "TemplateTypeParmDecl",
+// JSON-NEXT:               "name": "U"
+// JSON-NEXT:              }
+// JSON-NEXT:             },
+// JSON-NEXT:             {
+// JSON-NEXT:              "id": "0x{{.*}}",
+// JSON-NEXT:              "kind": "BuiltinType",
+// JSON-NEXT:              "type": {
+// JSON-NEXT:               "qualType": "int"
+// JSON-NEXT:              }
+// JSON-NEXT:             }
+// JSON-NEXT:            ]
+// JSON-NEXT:           }
+// JSON-NEXT:          ]
+// JSON-NEXT:         },
+// JSON-NEXT:         {
+// JSON-NEXT:          "id": "0x{{.*}}",
+// JSON-NEXT:          "kind": "TypeAliasDecl",
+// JSON-NEXT:          "loc": {
+// JSON-NEXT:           "offset": 5453,
+// JSON-NEXT:           "line": 163,
+// JSON-NEXT:           "col": 11,
+// JSON-NEXT:           "tokLen": 1
+// JSON-NEXT:          },
+// JSON-NEXT:          "range": {
+// JSON-NEXT:           "begin": {
+// JSON-NEXT:            "offset": 5447,
+// JSON-NEXT:            "col": 5,
+// JSON-NEXT:            "tokLen": 5
+// JSON-NEXT:           },
+// JSON-NEXT:           "end": {
+// JSON-NEXT:            "offset": 5470,
+// JSON-NEXT:            "col": 28,
+// JSON-NEXT:            "tokLen": 1
+// JSON-NEXT:           }
+// JSON-NEXT:          },
+// JSON-NEXT:          "name": "Y",
+// JSON-NEXT:          "type": {
+// JSON-NEXT:           "qualType": "int U::test::*"
+// JSON-NEXT:          },
+// JSON-NEXT:          "inner": [
+// JSON-NEXT:           {
+// JSON-NEXT:            "id": "0x{{.*}}",
+// JSON-NEXT:            "kind": "MemberPointerType",
+// JSON-NEXT:            "type": {
+// JSON-NEXT:             "qualType": "int U::test::*"
+// JSON-NEXT:            },
+// JSON-NEXT:            "isDependent": true,
+// JSON-NEXT:            "isInstantiationDependent": true,
+// JSON-NEXT:            "isData": true,
+// JSON-NEXT:            "inner": [
+// JSON-NEXT:             {
+// JSON-NEXT:              "id": "0x{{.*}}",
+// JSON-NEXT:              "kind": "BuiltinType",
+// JSON-NEXT:              "type": {
+// JSON-NEXT:               "qualType": "int"
+// JSON-NEXT:              }
+// JSON-NEXT:             }
+// JSON-NEXT:            ]
+// JSON-NEXT:           }
+// JSON-NEXT:          ]
+// JSON-NEXT:         },
+// JSON-NEXT:         {
+// JSON-NEXT:          "id": "0x{{.*}}",
+// JSON-NEXT:          "kind": "TypeAliasDecl",
+// JSON-NEXT:          "loc": {
+// JSON-NEXT:           "offset": 5483,
+// JSON-NEXT:           "line": 164,
+// JSON-NEXT:           "col": 11,
+// JSON-NEXT:           "tokLen": 1
+// JSON-NEXT:          },
+// JSON-NEXT:          "range": {
+// JSON-NEXT:           "begin": {
+// JSON-NEXT:            "offset": 5477,
+// JSON-NEXT:            "col": 5,
+// JSON-NEXT:            "tokLen": 5
+// JSON-NEXT:           },
+// JSON-NEXT:           "end": {
+// JSON-NEXT:            "offset": 5511,
+// JSON-NEXT:            "col": 39,
+// JSON-NEXT:            "tokLen": 1
+// JSON-NEXT:           }
+// JSON-NEXT:          },
+// JSON-NEXT:          "name": "Z",
+// JSON-NEXT:          "type": {
+// JSON-NEXT:           "qualType": "int U::template V<int>::*"
+// JSON-NEXT:          },
+// JSON-NEXT:          "inner": [
+// JSON-NEXT:           {
+// JSON-NEXT:            "id": "0x{{.*}}",
+// JSON-NEXT:            "kind": "MemberPointerType",
+// JSON-NEXT:            "type": {
+// JSON-NEXT:             "qualType": "int U::template V<int>::*"
+// JSON-NEXT:            },
+// JSON-NEXT:            "isDependent": true,
+// JSON-NEXT:            "isInstantiationDependent": true,
+// JSON-NEXT:            "isData": true,
+// JSON-NEXT:            "inner": [
+// JSON-NEXT:             {
+// JSON-NEXT:              "id": "0x{{.*}}",
+// JSON-NEXT:              "kind": "DependentTemplateSpecializationType",
+// JSON-NEXT:              "type": {
+// JSON-NEXT:               "qualType": "U::template V<int>"
+// JSON-NEXT:              },
+// JSON-NEXT:              "isDependent": true,
+// JSON-NEXT:              "isInstantiationDependent": true
+// JSON-NEXT:             },
+// JSON-NEXT:             {
+// JSON-NEXT:              "id": "0x{{.*}}",
+// JSON-NEXT:              "kind": "BuiltinType",
+// JSON-NEXT:              "type": {
+// JSON-NEXT:               "qualType": "int"
+// JSON-NEXT:              }
+// JSON-NEXT:             }
+// JSON-NEXT:            ]
+// JSON-NEXT:           }
+// JSON-NEXT:          ]
+// JSON-NEXT:         }
+// JSON-NEXT:        ]
+// JSON-NEXT:       }
+// JSON-NEXT:      ]
+// JSON-NEXT:     }
+// JSON-NEXT:    ]
 // JSON-NEXT:   }
 // JSON-NEXT:  ]
 // JSON-NEXT: }
diff --git a/clang/test/AST/ast-dump-types-json.cpp b/clang/test/AST/ast-dump-types-json.cpp
index 67379ac318e05..cc4d4d9a64872 100644
--- a/clang/test/AST/ast-dump-types-json.cpp
+++ b/clang/test/AST/ast-dump-types-json.cpp
@@ -264,158 +264,6 @@ using ::TestUsingShadowDeclType;
 // CHECK-NEXT:     },
 // CHECK-NEXT:     {
 // CHECK-NEXT:      "id": "0x{{.*}}",
-// CHECK-NEXT:      "kind": "CXXRecordDecl",
-// CHECK-NEXT:      "loc": {
-// CHECK-NEXT:       "offset": 158,
-// CHECK-NEXT:       "line": 7,
-// CHECK-NEXT:       "col": 8,
-// CHECK-NEXT:       "tokLen": 1
-// CHECK-NEXT:      },
-// CHECK-NEXT:      "range": {
-// CHECK-NEXT:       "begin": {
-// CHECK-NEXT:        "offset": 151,
-// CHECK-NEXT:        "col": 1,
-// CHECK-NEXT:        "tokLen": 6
-// CHECK-NEXT:       },
-// CHECK-NEXT:       "end": {
-// CHECK-NEXT:        "offset": 183,
-// CHECK-NEXT:        "line": 10,
-// CHECK-NEXT:        "col": 1,
-// CHECK-NEXT:        "tokLen": 1
-// CHECK-NEXT:       }
-// CHECK-NEXT:      },
-// CHECK-NEXT:      "name": "T",
-// CHECK-NEXT:      "tagUsed": "struct",
-// CHECK-NEXT:      "completeDefinition": true,
-// CHECK-NEXT:      "definitionData": {
-// CHECK-NEXT:       "canPassInRegisters": true,
-// CHECK-NEXT:       "copyAssign": {
-// CHECK-NEXT:        "hasConstParam": true,
-// CHECK-NEXT:        "implicitHasConstParam": true,
-// CHECK-NEXT:        "needsImplicit": true,
-// CHECK-NEXT:        "simple": true,
-// CHECK-NEXT:        "trivial": true
-// CHECK-NEXT:       },
-// CHECK-NEXT:       "copyCtor": {
-// CHECK-NEXT:        "hasConstParam": true,
-// CHECK-NEXT:        "implicitHasConstParam": true,
-// CHECK-NEXT:        "needsImplicit": true,
-// CHECK-NEXT:        "simple": true,
-// CHECK-NEXT:        "trivial": true
-// CHECK-NEXT:       },
-// CHECK-NEXT:       "defaultCtor": {
-// CHECK-NEXT:        "exists": true,
-// CHECK-NEXT:        "needsImplicit": true,
-// CHECK-NEXT:        "trivial": true
-// CHECK-NEXT:       },
-// CHECK-NEXT:       "dtor": {
-// CHECK-NEXT:        "irrelevant": true,
-// CHECK-NEXT:        "needsImplicit": true,
-// CHECK-NEXT:        "simple": true,
-// CHECK-NEXT:        "trivial": true
-// CHECK-NEXT:       },
-// CHECK-NEXT:       "isAggregate": true,
-// CHECK-NEXT:       "isLiteral": true,
-// CHECK-NEXT:       "isPOD": true,
-// CHECK-NEXT:       "isStandardLayout": true,
-// CHE...
[truncated]

Copy link
Contributor

@zyn0217 zyn0217 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly I have no idea what's going wrong here. But please go on to get rid of these bugs. Thanks!

@mizvekov mizvekov merged commit 89cfeeb into main Mar 28, 2025
10 of 12 checks passed
@mizvekov mizvekov deleted the users/mizvekov/member-pointer-strutural-equiv-fix branch March 28, 2025 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AST importer crash with CTU analysis enabled.
4 participants