[clang] [CodeGen] Remove unnecessary casts (NFC) (PR #146463)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 30 21:11:48 PDT 2025


https://github.com/kazutakahirata created https://github.com/llvm/llvm-project/pull/146463

Both of these functions return void.


>From ad23a71d5148d200f1db8c307ca3d60d1c229a56 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Mon, 30 Jun 2025 10:15:12 -0700
Subject: [PATCH] [CodeGen] Remove unnecessary casts (NFC)

Both of these functions return void.
---
 clang/lib/CodeGen/CGStmtOpenMP.cpp        | 2 +-
 clang/lib/CodeGen/ConstantInitBuilder.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index d9195d749e056..5822e0f6db89a 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -713,7 +713,7 @@ CodeGenFunction::GenerateOpenMPCapturedStmtFunction(const CapturedStmt &S,
     VLASizeMap[VLASizePair.second.first] = VLASizePair.second.second;
   PGO->assignRegionCounters(GlobalDecl(CD), F);
   CapturedStmtInfo->EmitBody(*this, CD->getBody());
-  (void)LocalScope.ForceCleanup();
+  LocalScope.ForceCleanup();
   FinishFunction(CD->getBodyRBrace());
   if (!NeedWrapperFunction)
     return F;
diff --git a/clang/lib/CodeGen/ConstantInitBuilder.cpp b/clang/lib/CodeGen/ConstantInitBuilder.cpp
index ce1fe137c1919..7b3e7aea0f647 100644
--- a/clang/lib/CodeGen/ConstantInitBuilder.cpp
+++ b/clang/lib/CodeGen/ConstantInitBuilder.cpp
@@ -160,7 +160,7 @@ ConstantAggregateBuilderBase::getAddrOfPosition(llvm::Type *type,
                                         nullptr, "");
   Builder.SelfReferences.emplace_back(dummy);
   auto &entry = Builder.SelfReferences.back();
-  (void)getGEPIndicesTo(entry.Indices, position + Begin);
+  getGEPIndicesTo(entry.Indices, position + Begin);
   return dummy;
 }
 



More information about the cfe-commits mailing list