Skip to content

Commit 1cb82ff

Browse files
committed
[clang][CIR] Fix various warnings. NFC
- Fix various warnings including '-Wparentheses', '-Wunused-variable', and '-Wreturn-type'.
1 parent e18a77c commit 1cb82ff

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

clang/include/clang/CIR/Dialect/IR/CIRTypesDetails.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ struct RecordTypeStorage : public mlir::TypeStorage {
5454
RecordType::RecordKind kind)
5555
: members(members), name(name), incomplete(incomplete), packed(packed),
5656
padded(padded), kind(kind) {
57-
assert(name || !incomplete && "Incomplete records must have a name");
57+
assert((name || !incomplete) && "Incomplete records must have a name");
5858
}
5959

6060
KeyTy getAsKey() const {

clang/lib/CIR/CodeGen/CIRGenBuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ class CIRGenBuilderTy : public cir::CIRBaseBuilderTy {
6363
case clang::TagTypeKind::Enum:
6464
llvm_unreachable("enums are not records");
6565
}
66+
llvm_unreachable("Unsupported record kind");
6667
}
6768

6869
/// Get an incomplete CIR struct type. If we have a complete record

clang/lib/CIR/CodeGen/CIRGenTypes.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ isSafeToConvert(const RecordDecl *rd, CIRGenTypes &cgt,
153153
// out, don't do it. This includes virtual base classes which get laid out
154154
// when a class is translated, even though they aren't embedded by-value into
155155
// the class.
156-
if (const CXXRecordDecl *crd = dyn_cast<CXXRecordDecl>(rd)) {
156+
if (isa<CXXRecordDecl>(rd)) {
157157
assert(!cir::MissingFeatures::cxxSupport());
158158
cgt.getCGModule().errorNYI(rd->getSourceRange(),
159159
"isSafeToConvert: CXXRecordDecl");
@@ -237,7 +237,7 @@ mlir::Type CIRGenTypes::convertRecordDeclType(const clang::RecordDecl *rd) {
237237
assert(insertResult && "isSafeToCovert() should have caught this.");
238238

239239
// Force conversion of non-virtual base classes recursively.
240-
if (const auto *cxxRecordDecl = dyn_cast<CXXRecordDecl>(rd)) {
240+
if (isa<CXXRecordDecl>(rd)) {
241241
cgm.errorNYI(rd->getSourceRange(), "CXXRecordDecl");
242242
}
243243

0 commit comments

Comments
 (0)