[clang] [CIR][NFC] Fix an unused variable warning (PR #136431)
via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 19 06:33:46 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-clangir
Author: Amr Hesham (AmrDeveloper)
<details>
<summary>Changes</summary>
This fixes a warning where a variable assigned in 'if' statement wasn't referenced again.
---
Full diff: https://github.com/llvm/llvm-project/pull/136431.diff
1 Files Affected:
- (modified) clang/lib/CIR/CodeGen/CIRGenTypes.cpp (+2-2)
``````````diff
diff --git a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
index c286aef360b01..1e1a2c4fee585 100644
--- a/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenTypes.cpp
@@ -153,7 +153,7 @@ isSafeToConvert(const RecordDecl *rd, CIRGenTypes &cgt,
// out, don't do it. This includes virtual base classes which get laid out
// when a class is translated, even though they aren't embedded by-value into
// the class.
- if (const CXXRecordDecl *crd = dyn_cast<CXXRecordDecl>(rd)) {
+ if (isa<CXXRecordDecl>(rd)) {
assert(!cir::MissingFeatures::cxxSupport());
cgt.getCGModule().errorNYI(rd->getSourceRange(),
"isSafeToConvert: CXXRecordDecl");
@@ -237,7 +237,7 @@ mlir::Type CIRGenTypes::convertRecordDeclType(const clang::RecordDecl *rd) {
assert(insertResult && "isSafeToCovert() should have caught this.");
// Force conversion of non-virtual base classes recursively.
- if (const auto *cxxRecordDecl = dyn_cast<CXXRecordDecl>(rd)) {
+ if (isa<CXXRecordDecl>(rd)) {
cgm.errorNYI(rd->getSourceRange(), "CXXRecordDecl");
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/136431
More information about the cfe-commits
mailing list