Debian Codegraph @

build/build-clang/android-hardware-buffer-header-workaround_clang_21.patch

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