Skip to content

Avoid unusable variable in ByteCodeExprGen.cpp #90469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 29, 2024
Merged

Conversation

dklimkin
Copy link
Member

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

Inline assert to avoid unusable variable warning/error when asserts are disabled.
@dklimkin dklimkin requested a review from tbaederr as a code owner April 29, 2024 13:20
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Apr 29, 2024
@llvmbot
Copy link
Member

llvmbot commented Apr 29, 2024

@llvm/pr-subscribers-clang

Author: Danial Klimkin (dklimkin)

Changes

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

@dklimkin dklimkin merged commit e57b872 into llvm:main Apr 29, 2024
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants