[clang] [HLSL] add parentheses in assertion to eliminate -Wparentheses warning (PR #128246)

Oleksandr T. via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 21 15:02:33 PST 2025


https://github.com/a-tarasyuk created https://github.com/llvm/llvm-project/pull/128246

Fixes #128210 

>From 55a38b8d5c8864557f20f642a7202c6242aa3b83 Mon Sep 17 00:00:00 2001
From: Oleksandr T <oleksandr.tarasiuk at outlook.com>
Date: Sat, 22 Feb 2025 01:01:41 +0200
Subject: [PATCH] [HLSL] add parentheses in assertion to eliminate
 -Wparentheses warning

---
 clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp b/clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp
index 1ae00023ab2bc..97262b76c0164 100644
--- a/clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp
+++ b/clang/lib/CodeGen/HLSLBufferLayoutBuilder.cpp
@@ -89,9 +89,9 @@ llvm::TargetExtType *HLSLBufferLayoutBuilder::createLayoutType(
     RecordTypes.pop_back();
 
     for (const auto *FD : RT->getDecl()->fields()) {
-      assert(!Packoffsets || Index < Packoffsets->size() &&
-                                 "number of elements in layout struct does not "
-                                 "match number of packoffset annotations");
+      assert((!Packoffsets || Index < Packoffsets->size()) &&
+             "number of elements in layout struct does not "
+             "match number of packoffset annotations");
 
       if (!layoutField(FD, EndOffset, Layout, LayoutElements,
                        Packoffsets ? (*Packoffsets)[Index] : -1))



More information about the cfe-commits mailing list