[clang] [clang] ASTContex: fix getCommonSugaredType for array types (PR #132559)

via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 25 07:05:41 PDT 2025


================
@@ -14371,6 +14375,22 @@ QualType ASTContext::getCommonSugaredType(QualType X, QualType Y,
   // necessarily canonical types, as they may still have sugared properties.
   // QX and QY will store the sum of all qualifiers in Xs and Ys respectively.
   auto Xs = ::unwrapSugar(SX, QX), Ys = ::unwrapSugar(SY, QY);
+
+  // If this is an ArrayType, the element qualifiers are interchangeable with
+  // the top level qualifiers.
+  // * In case the canonical nodes are the same, the elements types are already
+  // the same.
+  // * Otherwise, the element types will be made the same, and any different
+  // element qualifiers will be pumped up to the top level qualifiers, per
----------------
cor3ntin wrote:

```suggestion
  // element qualifiers will be moved up to the top level qualifiers, per
```
or propagated

https://github.com/llvm/llvm-project/pull/132559


More information about the cfe-commits mailing list