Submitted by:            Xi Ruoyao <xry111@xry111.site>
Date:                    2026-03-07
Initial Package Version: 140.8.0
Upstream Status:         Applied in rust-bindgen and skcms but not applied
                         for Firefox yet.  Reported at firefix PR 1977771
                         comment 2.
Origin:                  rust-bindgen and skcms upstream repo;
                         the test suite change and two redundant changes
                         cancelling each other out are dropped from the
                         rust-bindgen change; the file paths are manually
                         edited for the firefox source tree.
Description:             Allow building firefox with LLVM (clang) 22.

diff --git a/bindgen/clang.rs b/bindgen/clang.rs
index e52fed0d4a..1e8326ed82 100644
--- a/third_party/rust/bindgen/clang.rs
+++ b/third_party/rust/bindgen/clang.rs
@@ -1211,11 +1211,11 @@ impl Type {

     /// Get a cursor pointing to this type's declaration.
     pub(crate) fn declaration(&self) -> Cursor {
-        unsafe {
-            Cursor {
-                x: clang_getTypeDeclaration(self.x),
-            }
-        }
+        let decl = Cursor {
+            x: unsafe { clang_getTypeDeclaration(self.x) },
+        };
+        // Prior to clang 22, the declaration pointed to the definition.
+        decl.definition().unwrap_or(decl)
     }


From 135488419331644e59091ecc73e682299d3937a4 Mon Sep 17 00:00:00 2001
From: Devon Loehr <dloehr@google.com>
Date: Fri, 15 Aug 2025 14:31:27 +0000
Subject: [PATCH] Change use of removed intrinsic

A recent LLVM change removed the __builtin_ia32_vcvtph2ps256 intrinsic
because it can be implemented using __builtin_shufflevector and/or
__builtin_convertvector. This CL changes skia to use convertvector as
to match.

Bug: chromium:438445382
Change-Id: I2ed16cd507d7feeafba4c082b3840cbdd6368dd9
Reviewed-on: https://skia-review.googlesource.com/c/skcms/+/1038217
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Ben Wagner <bungeman@google.com>
Auto-Submit: Devon Loehr <dloehr@google.com>
---

diff --git a/src/Transform_inl.h b/src/Transform_inl.h
index bc10e7d..99faf25 100644
--- a/gfx/skia/skia/modules/skcms/src/Transform_inl.h
+++ b/gfx/skia/skia/modules/skcms/src/Transform_inl.h
@@ -156,8 +156,8 @@
 #elif defined(USING_AVX512F)
     return (F)_mm512_cvtph_ps((__m256i)half);
 #elif defined(USING_AVX_F16C)
-    typedef int16_t __attribute__((vector_size(16))) I16;
-    return __builtin_ia32_vcvtph2ps256((I16)half);
+    typedef _Float16 __attribute__((vector_size(16))) F16;
+    return __builtin_convertvector((F16)half, F);
 #else
     U32 wide = cast<U32>(half);
     // A half is 1-5-10 sign-exponent-mantissa, with 15 exponent bias.
