https://github.com/dyung created
https://github.com/llvm/llvm-project/pull/230939
PR #174549 made a change to `APValue.h` which causes GCC to emit a warning like
this:
```
clang/include/clang/AST/APValue.h: In static member function ‘static
clang::DynamicAllocLValue clang::DynamicAllocLValue::getFromOpaqueValue(const
void*)’:
clang/include/clang/AST/APValue.h:114:54: warning: suggest parentheses around
‘-’ in operand of ‘&’ [-Wparentheses]
114 | V.AllocKind = Combined & (1 << NumAllocKindBits) - 1;
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~
```
>From my build with gcc, this shows up around 1200 times in the logfile for my
>build. The problem with this is that for distributed builds, this forces the
>build of the file where the warning is emitted to be done locally which causes
>a bottleneck. This fixes the source of the warning so that the build of the
>files which include `APValue.h` can again be distributed.
>From 85a7723d280d03eeaa936e19bb5731beba16e63d Mon Sep 17 00:00:00 2001
From: Douglas Yung <[email protected]>
Date: Sun, 11 Oct 2026 03:11:30 -0700
Subject: [PATCH] Fix GCC warning by enclosing operand with parentheses.
---
clang/include/clang/AST/APValue.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/clang/include/clang/AST/APValue.h
b/clang/include/clang/AST/APValue.h
index 54e51b7e2fd34..7a69a98702a8c 100644
--- a/clang/include/clang/AST/APValue.h
+++ b/clang/include/clang/AST/APValue.h
@@ -112,7 +112,7 @@ class DynamicAllocLValue {
DynamicAllocLValue V;
uintptr_t Combined =
reinterpret_cast<uintptr_t>(Value) >> NumLowBitsAvailable;
- V.AllocKind = Combined & (1 << NumAllocKindBits) - 1;
+ V.AllocKind = Combined & ((1 << NumAllocKindBits) - 1);
V.Index = Combined >> NumAllocKindBits;
return V;
}
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits