https://github.com/mizvekov created 
https://github.com/llvm/llvm-project/pull/135434

This fixes a problem originally reported here:
https://github.com/llvm/llvm-project/pull/132401#issuecomment-2795078260

This makes sure we only serialize the class declaration when its strictly 
needed, and canonicalizes it, so it doesn't change in ways that don't round 
trip.

There are no release notes, since this regression was never released.

>From 04130f259ba19db0ac64baf01a773bffdcf8164d Mon Sep 17 00:00:00 2001
From: Matheus Izvekov <mizve...@gmail.com>
Date: Fri, 11 Apr 2025 17:13:53 -0300
Subject: [PATCH] [clang] WIP: Fix MemberPointer serialization non-determinism

This fixes a problem originally reported here:
https://github.com/llvm/llvm-project/pull/132401#issuecomment-2795078260

This makes sure we only serialize the class declaration when its strictly
needed, and canonicalizes it, so it doesn't change in ways that don't round
trip.

There are no release notes, since this regression was never released.
---
 clang/include/clang/AST/TypeProperties.td | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/AST/TypeProperties.td 
b/clang/include/clang/AST/TypeProperties.td
index 66d490850678a..2eaad84a3ff70 100644
--- a/clang/include/clang/AST/TypeProperties.td
+++ b/clang/include/clang/AST/TypeProperties.td
@@ -104,7 +104,8 @@ let Class = MemberPointerType in {
     let Read = [{ node->getQualifier() }];
   }
   def : Property<"Cls", DeclRef> {
-    let Read = [{ node->getMostRecentCXXRecordDecl() }];
+    let Read =
+        [{ node->isSugared() ? 
node->getMostRecentCXXRecordDecl()->getCanonicalDecl() : nullptr }];
   }
 
   def : Creator<[{

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to