[clang] Avoid unusable variable in ByteCodeExprGen.cpp (PR #90469)

Danial Klimkin via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 29 06:20:54 PDT 2024


https://github.com/dklimkin created https://github.com/llvm/llvm-project/pull/90469

Inline assert to avoid unusable variable warning/error when asserts are disabled.

>From 4935be526d3f5f529924d5bef9cc36167a9e5c5c Mon Sep 17 00:00:00 2001
From: Danial Klimkin <dklimkin at google.com>
Date: Mon, 29 Apr 2024 15:20:03 +0200
Subject: [PATCH] Avoid unusable variable in ByteCodeExprGen.cpp

Inline assert to avoid unusable variable warning/error when asserts are disabled.
---
 clang/lib/AST/Interp/ByteCodeExprGen.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
index 626c30157b228f..568a929c6a1693 100644
--- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp
+++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp
@@ -2363,8 +2363,7 @@ bool ByteCodeExprGen<Emitter>::VisitCXXUuidofExpr(const CXXUuidofExpr *E) {
   if (!this->emitGetPtrGlobal(*GlobalIndex, E))
     return false;
 
-  const Record *R = this->getRecord(E->getType());
-  assert(R);
+  assert(this->getRecord(E->getType()));
 
   const APValue &V = E->getGuidDecl()->getAsAPValue();
   if (V.getKind() == APValue::None)



More information about the cfe-commits mailing list