Skip to content

Commit e5d9644

Browse files
authored
[NFC] [DirectX] Fix warning about parentheses for assertion in DXContainerGlobals.cpp (#166231)
This PR fixes the appearance of the following warning message when building LLVM with clang (21.1.2) ``` [48/100] Building CXX object lib/Target/DirectX/CMakeFiles/LLVMDirectXCodeGen.dir/DXContainerGlobals.cpp.o In file included from /nix/store/ffrg0560kj0066s4k9pznjand907nlnz-gcc-14.3.0/include/c++/14.3.0/cassert:44, from /workspace/llvm-project/llvm/include/llvm/Support/Endian.h:19, from /workspace/llvm-project/llvm/include/llvm/Support/MD5.h:33, from /workspace/llvm-project/llvm/lib/Target/DirectX/DXContainerGlobals.cpp:28: /workspace/llvm-project/llvm/lib/Target/DirectX/DXContainerGlobals.cpp: In lambda function: /workspace/llvm-project/llvm/lib/Target/DirectX/DXContainerGlobals.cpp:198:78: warning: suggest parentheses around ‘&&’ within ‘||’ [-Wparentheses] 198 | (uint64_t)Binding.LowerBound + Binding.Size - 1 <= UINT32_MAX && | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ 199 | "Resource range is too large"); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ``` I marked this PR as an NFC because it only modifies an assertion condition to remove a compiler warning.
1 parent 9ff31be commit e5d9644

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

llvm/lib/Target/DirectX/DXContainerGlobals.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,10 @@ void DXContainerGlobals::addResourcesForPSV(Module &M, PSVRuntimeInfo &PSV) {
194194
dxbc::PSV::v2::ResourceBindInfo BindInfo;
195195
BindInfo.Type = Type;
196196
BindInfo.LowerBound = Binding.LowerBound;
197-
assert(Binding.Size == UINT32_MAX ||
198-
(uint64_t)Binding.LowerBound + Binding.Size - 1 <= UINT32_MAX &&
199-
"Resource range is too large");
197+
assert(
198+
(Binding.Size == UINT32_MAX ||
199+
(uint64_t)Binding.LowerBound + Binding.Size - 1 <= UINT32_MAX) &&
200+
"Resource range is too large");
200201
BindInfo.UpperBound = (Binding.Size == UINT32_MAX)
201202
? UINT32_MAX
202203
: Binding.LowerBound + Binding.Size - 1;

0 commit comments

Comments
 (0)