https://github.com/hnrklssn created 
https://github.com/llvm/llvm-project/pull/67822

The addition of the type kind to the profile ID of IntegerLiterals results in 
e.g. size_t and unsigned long literals mismatch even on platforms where they 
are canonically the same type. This patch checks the Canonical field to 
determine whether to canonicalize the type first.

rdar://116063468

>From 8ebdc7b829a3c2f59ef2773332511c81a40a8e73 Mon Sep 17 00:00:00 2001
From: "Henrik G. Olsson" <hnrkl...@gmail.com>
Date: Fri, 29 Sep 2023 17:33:57 +0200
Subject: [PATCH] [clang] Add missing canonicalization in int literal profile

The addition of the type kind to the profile ID of IntegerLiterals
results in e.g. size_t and unsigned long literals mismatch even on
platforms where they are canonically the same type. This patch checks
the Canonical field to determine whether to canonicalize the type first.

rdar://116063468
---
 clang/lib/AST/StmtProfile.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/lib/AST/StmtProfile.cpp b/clang/lib/AST/StmtProfile.cpp
index 2e4f15f83ac26ef..763d3d612698095 100644
--- a/clang/lib/AST/StmtProfile.cpp
+++ b/clang/lib/AST/StmtProfile.cpp
@@ -1335,6 +1335,8 @@ void StmtProfiler::VisitIntegerLiteral(const 
IntegerLiteral *S) {
   S->getValue().Profile(ID);
 
   QualType T = S->getType();
+  if (Canonical)
+    T = T.getCanonicalType();
   ID.AddInteger(T->getTypeClass());
   if (auto BitIntT = T->getAs<BitIntType>())
     BitIntT->Profile(ID);

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

Reply via email to