[clang] 5317912 - [clang] Add missing canonicalization in int literal profile (#67822)

via cfe-commits cfe-commits at lists.llvm.org
Mon Oct 2 01:03:38 PDT 2023


Author: Henrik G. Olsson
Date: 2023-10-02T10:03:32+02:00
New Revision: 53179129edbff13644b7c46336773fb8740899c9

URL: https://github.com/llvm/llvm-project/commit/53179129edbff13644b7c46336773fb8740899c9
DIFF: https://github.com/llvm/llvm-project/commit/53179129edbff13644b7c46336773fb8740899c9.diff

LOG: [clang] Add missing canonicalization in int literal profile (#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

Added: 
    

Modified: 
    clang/lib/AST/StmtProfile.cpp

Removed: 
    


################################################################################
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);


        


More information about the cfe-commits mailing list