-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[CIR] Fix warnings related to unused variables in release builds #151412
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
Changes from 1 commit
ceabe27
5fa2289
bd8f03b
c794a25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1472,9 +1472,10 @@ Address CIRGenFunction::emitArrayToPointerDecay(const Expr *e) { | |
| if (e->getType()->isVariableArrayType()) | ||
| return addr; | ||
|
|
||
| auto pointeeTy = mlir::cast<cir::ArrayType>(lvalueAddrTy.getPointee()); | ||
| [[maybe_unused]] auto pointeeTy = | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These could be sunk into the asserts, but the expressions would need to be repeated. I was on the fence about which way to go. |
||
| mlir::cast<cir::ArrayType>(lvalueAddrTy.getPointee()); | ||
|
|
||
| mlir::Type arrayTy = convertType(e->getType()); | ||
| [[maybe_unused]] mlir::Type arrayTy = convertType(e->getType()); | ||
| assert(mlir::isa<cir::ArrayType>(arrayTy) && "expected array"); | ||
| assert(pointeeTy == arrayTy); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -439,7 +439,7 @@ class ScalarExprEmitter : public StmtVisitor<ScalarExprEmitter, mlir::Value> { | |
| value = builder.getTrue(cgf.getLoc(e->getExprLoc())); | ||
| } else if (type->isIntegerType()) { | ||
| QualType promotedType; | ||
| bool canPerformLossyDemotionCheck = false; | ||
| [[maybe_unused]] bool canPerformLossyDemotionCheck = false; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is written to but never read. It will be read when sanitizer support is added. |
||
| if (cgf.getContext().isPromotableIntegerType(type)) { | ||
| promotedType = cgf.getContext().getPromotedIntegerType(type); | ||
| assert(promotedType != type && "Shouldn't promote to the same type."); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -216,7 +216,7 @@ void CIRGenFunction::emitAndUpdateRetAlloca(QualType type, mlir::Location loc, | |
| void CIRGenFunction::declare(mlir::Value addrVal, const Decl *var, QualType ty, | ||
| mlir::Location loc, CharUnits alignment, | ||
| bool isParam) { | ||
| const auto *namedVar = dyn_cast_or_null<NamedDecl>(var); | ||
| [[maybe_unused]] const auto *namedVar = dyn_cast_or_null<NamedDecl>(var); | ||
|
||
| assert(namedVar && "Needs a named decl"); | ||
| assert(!cir::MissingFeatures::cgfSymbolTable()); | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -80,12 +80,12 @@ mlir::LogicalResult CIRGenFunction::emitStmt(const Stmt *s, | |
| #include "clang/AST/StmtNodes.inc" | ||
| { | ||
| // Remember the block we came in on. | ||
| mlir::Block *incoming = builder.getInsertionBlock(); | ||
| [[maybe_unused]] mlir::Block *incoming = builder.getInsertionBlock(); | ||
|
||
| assert(incoming && "expression emission must have an insertion point"); | ||
|
|
||
| emitIgnoredExpr(cast<Expr>(s)); | ||
|
|
||
| mlir::Block *outgoing = builder.getInsertionBlock(); | ||
| [[maybe_unused]] mlir::Block *outgoing = builder.getInsertionBlock(); | ||
| assert(outgoing && "expression emission cleared block!"); | ||
| return mlir::success(); | ||
| } | ||
|
|
||
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.
Ironic, isn't it?