-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[CIR][NFS] Fix dead code return statement warning #142591
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
Conversation
@llvm/pr-subscribers-clang Author: Amr Hesham (AmrDeveloper) ChangesFix the warning related to the missing return statement and multiple return statements Full diff: https://github.com/llvm/llvm-project/pull/142591.diff 1 Files Affected:
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
index 77287ec45972d..9404d6d66cf20 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
@@ -102,8 +102,9 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
mlir::Type dstTy) const {
if (mlir::isa<cir::IntType>(dstTy))
return builder.createBoolToInt(value, dstTy);
- if (mlir::isa<cir::BoolType>(dstTy))
- return value;
+
+ assert(mlir::isa<cir::BoolType>(dstTy) && "Expect bool type");
+ return value;
}
//===--------------------------------------------------------------------===//
@@ -1857,9 +1858,6 @@ mlir::Value ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *e) {
// ZExt result to the expr type.
return maybePromoteBoolResult(boolVal, cgf.convertType(e->getType()));
-
- cgf.cgm.errorNYI("destination type for logical-not unary operator is NYI");
- return {};
}
/// Return the size or alignment of the type of argument of the sizeof
|
@llvm/pr-subscribers-clangir Author: Amr Hesham (AmrDeveloper) ChangesFix the warning related to the missing return statement and multiple return statements Full diff: https://github.com/llvm/llvm-project/pull/142591.diff 1 Files Affected:
diff --git a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
index 77287ec45972d..9404d6d66cf20 100644
--- a/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
+++ b/clang/lib/CIR/CodeGen/CIRGenExprScalar.cpp
@@ -102,8 +102,9 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> {
mlir::Type dstTy) const {
if (mlir::isa<cir::IntType>(dstTy))
return builder.createBoolToInt(value, dstTy);
- if (mlir::isa<cir::BoolType>(dstTy))
- return value;
+
+ assert(mlir::isa<cir::BoolType>(dstTy) && "Expect bool type");
+ return value;
}
//===--------------------------------------------------------------------===//
@@ -1857,9 +1858,6 @@ mlir::Value ScalarExprEmitter::VisitUnaryLNot(const UnaryOperator *e) {
// ZExt result to the expr type.
return maybePromoteBoolResult(boolVal, cgf.convertType(e->getType()));
-
- cgf.cgm.errorNYI("destination type for logical-not unary operator is NYI");
- return {};
}
/// Return the size or alignment of the type of argument of the sizeof
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
5a47507
to
0c59770
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (and thanks!)
Fix the warning related to the missing return statement and multiple return statements
Fix the warning related to the missing return statement and multiple return statements
Fix the warning related to the missing return statement and multiple return statements