[clang] 1cb82ff - [clang][CIR] Fix various warnings. NFC
Michael Liao via cfe-commits
cfe-commits at lists.llvm.org
Mon Apr 21 07:52:30 PDT 2025
Author: Michael Liao
Date: 2025-04-21T10:52:23-04:00
New Revision: 1cb82ff9cd95c216f6d8da18637ee47a15bd41f6
URL: https://github.com/llvm/llvm-project/commit/1cb82ff9cd95c216f6d8da18637ee47a15bd41f6
DIFF: https://github.com/llvm/llvm-project/commit/1cb82ff9cd95c216f6d8da18637ee47a15bd41f6.diff
LOG: [clang][CIR] Fix various warnings. NFC
- Fix various warnings including '-Wparentheses', '-Wunused-variable',
and '-Wreturn-type'.
Added:
Modified:
clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h
clang/lib/CIR/CodeGen/CIRGenBuilder.h
clang/lib/CIR/CodeGen/CIRGenTypes.cpp
Removed:
################################################################################
diff --git a/clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h b/clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h
index 72ead2381ee47..de8c17cab8642 100644
--- a/clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h
+++ b/clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h
@@ -54,7 +54,7 @@ struct RecordTypeStorage : public mlir::TypeStorage {
RecordType::RecordKind kind)
: members(members), name(name), incomplete(incomplete), packed(packed),
padded(padded), kind(kind) {
- assert(name || !incomplete && "Incomplete records must have a name");
+ assert((name || !incomplete) && "Incomplete records must have a name");
}
KeyTy getAsKey() const {
diff --git a/clang/lib/CIR/CodeGen/CIRGenBuilder.h b/clang/lib/CIR/CodeGen/CIRGenBuilder.h
index d98416734b56e..4f7ff5128d914 100644
--- a/clang/lib/CIR/CodeGen/CIRGenBuilder.h
+++ b/clang/lib/CIR/CodeGen/CIRGenBuilder.h
@@ -63,6 +63,7 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
case clang::TagTypeKind::Enum:
llvm_unreachable("enums are not records");
}
+ llvm_unreachable("Unsupported record kind");
}
/// Get an incomplete CIR struct type. If we have a complete record
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");
}
More information about the cfe-commits
mailing list