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

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 29 06:21:27 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang

Author: Danial Klimkin (dklimkin)

<details>
<summary>Changes</summary>

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

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


1 Files Affected:

- (modified) clang/lib/AST/Interp/ByteCodeExprGen.cpp (+1-2) 


``````````diff
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)

``````````

</details>


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


More information about the cfe-commits mailing list