Author: Timm Bäder Date: 2024-01-27T09:06:04+01:00 New Revision: ce75cbeda21e3e4e5d0c47ecf44954caf98acfe8
URL: https://github.com/llvm/llvm-project/commit/ce75cbeda21e3e4e5d0c47ecf44954caf98acfe8 DIFF: https://github.com/llvm/llvm-project/commit/ce75cbeda21e3e4e5d0c47ecf44954caf98acfe8.diff LOG: [clang][Interp][NFC] Don't unnecessarily use std::optional classifyComplexElementType() doesn't return a std::optional anymore. Added: Modified: clang/lib/AST/Interp/ByteCodeExprGen.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index 6cce9b9cb0a2ab7..d4501cefb2131da 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -231,10 +231,7 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) { case CK_IntegralComplexToBoolean: case CK_FloatingComplexToBoolean: { - std::optional<PrimType> ElemT = - classifyComplexElementType(SubExpr->getType()); - if (!ElemT) - return false; + PrimType ElemT = classifyComplexElementType(SubExpr->getType()); // We emit the expression (__real(E) != 0 || __imag(E) != 0) // for us, that means (bool)E[0] || (bool)E[1] if (!this->visit(SubExpr)) @@ -243,13 +240,13 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) { return false; if (!this->emitArrayElemPtrUint8(CE)) return false; - if (!this->emitLoadPop(*ElemT, CE)) + if (!this->emitLoadPop(ElemT, CE)) return false; - if (*ElemT == PT_Float) { + if (ElemT == PT_Float) { if (!this->emitCastFloatingIntegral(PT_Bool, CE)) return false; } else { - if (!this->emitCast(*ElemT, PT_Bool, CE)) + if (!this->emitCast(ElemT, PT_Bool, CE)) return false; } @@ -262,13 +259,13 @@ bool ByteCodeExprGen<Emitter>::VisitCastExpr(const CastExpr *CE) { return false; if (!this->emitArrayElemPtrPopUint8(CE)) return false; - if (!this->emitLoadPop(*ElemT, CE)) + if (!this->emitLoadPop(ElemT, CE)) return false; - if (*ElemT == PT_Float) { + if (ElemT == PT_Float) { if (!this->emitCastFloatingIntegral(PT_Bool, CE)) return false; } else { - if (!this->emitCast(*ElemT, PT_Bool, CE)) + if (!this->emitCast(ElemT, PT_Bool, CE)) return false; } // Leave the boolean value of E[1] on the stack. _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits