1
0
Fork 0
firefox/build/build-clang/android-hardware-buffer-header-workaround_clang_21.patch
Daniel Baumann 5e9a113729
Adding upstream version 140.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
2025-06-25 09:37:52 +02:00

34 lines
1.3 KiB
Diff

From 3e5c4b07f9413822ec2dc82174a13abc59a7b6d2 Mon Sep 17 00:00:00 2001
From: Mike Hommey <mh@glandium.org>
Date: Tue, 8 Oct 2024 13:33:53 +0900
Subject: [PATCH] [clang] Don't emit IntegerConstantExpression error on Android
NDK headers
The Android NDK versions before r28 have an enum value with a large
shift count in hardware_buffer.h, which is undefined behavior and that
is now caught as of #70307, and can't be overridden.
This change relaxes the check to not apply to system headers on Android.
---
clang/lib/Sema/SemaExpr.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/clang/lib/Sema/SemaExpr.cpp b/clang/lib/Sema/SemaExpr.cpp
index 6e8aa1a362c5..b36e5cd8faba 100644
--- a/clang/lib/Sema/SemaExpr.cpp
+++ b/clang/lib/Sema/SemaExpr.cpp
@@ -17525,7 +17525,10 @@ Sema::VerifyIntegerConstantExpression(Expr *E, llvm::APSInt *Result,
}
if (!Folded || CanFold == AllowFoldKind::No) {
- if (!Diagnoser.Suppress) {
+ if (!Diagnoser.Suppress &&
+ (!EvalResult.HasUndefinedBehavior ||
+ !Context.getTargetInfo().getTriple().isAndroid() ||
+ !getSourceManager().isInSystemHeader(DiagLoc))) {
Diagnoser.diagnoseNotICE(*this, DiagLoc) << E->getSourceRange();
for (const PartialDiagnosticAt &Note : Notes)
Diag(Note.first, Note.second);
--
2.47.0.1.g59ce1bf855