[clang] [clang] Fix a couple of gcc Wparentheses warnings. NFC. (PR #177134)

via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 21 03:00:41 PST 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-analysis

Author: Simon Pilgrim (RKSimon)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/177134.diff


2 Files Affected:

- (modified) clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp (+3-3) 
- (modified) clang/lib/Sema/SemaOpenMP.cpp (+2-3) 


``````````diff
diff --git a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
index ccedd0522cbb3..d5990597e1614 100644
--- a/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
+++ b/clang/lib/Analysis/LifetimeSafety/FactsGenerator.cpp
@@ -402,9 +402,9 @@ void FactsGenerator::VisitMaterializeTemporaryExpr(
   if (!MTEList)
     return;
   OriginList *SubExprList = getOriginsList(*MTE->getSubExpr());
-  assert(!SubExprList ||
-         MTEList->getLength() == SubExprList->getLength() + 1 &&
-             "MTE top level origin should contain a loan to the MTE itself");
+  assert((!SubExprList ||
+          MTEList->getLength() == (SubExprList->getLength() + 1)) &&
+         "MTE top level origin should contain a loan to the MTE itself");
   MTEList = getRValueOrigins(MTE, MTEList);
   if (getChildBinding(MTE)) {
     // Issue a loan to MTE for the storage location represented by MTE.
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 084abaf487bb8..456e94a009d2f 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -24816,9 +24816,8 @@ SemaOpenMP::ActOnOpenMPUseDeviceAddrClause(ArrayRef<Expr *> VarList,
 
     // Get the declaration from the components
     ValueDecl *CurDeclaration = CurComponents.back().getAssociatedDeclaration();
-    assert(isa<CXXThisExpr>(BE) ||
-           CurDeclaration &&
-               "Unexpected null decl for use_device_addr clause.");
+    assert((isa<CXXThisExpr>(BE) || CurDeclaration) &&
+           "Unexpected null decl for use_device_addr clause.");
 
     MVLI.VarBaseDeclarations.push_back(CurDeclaration);
     MVLI.VarComponents.resize(MVLI.VarComponents.size() + 1);

``````````

</details>


https://github.com/llvm/llvm-project/pull/177134


More information about the cfe-commits mailing list