diff options
author | Timm Bäder <tbaeder@redhat.com> | 2024-01-24 12:47:51 +0100 |
---|---|---|
committer | Timm Bäder <tbaeder@redhat.com> | 2024-01-24 12:56:16 +0100 |
commit | dee02ee9f8ffc74fea6c54f4c00df16e7ca4c8a1 (patch) | |
tree | 37db8327c9152b35b1543b74116b75317d426093 | |
parent | c83180c1248615cf6ea8842eb4e0cebebba4ab57 (diff) | |
download | llvm-dee02ee9f8ffc74fea6c54f4c00df16e7ca4c8a1.zip llvm-dee02ee9f8ffc74fea6c54f4c00df16e7ca4c8a1.tar.gz llvm-dee02ee9f8ffc74fea6c54f4c00df16e7ca4c8a1.tar.bz2 |
[clang][Interp][NFC] Complex elements can only be primitives
So, return a PrimType directly from classifyComplexElementType().
-rw-r--r-- | clang/lib/AST/Interp/ByteCodeExprGen.cpp | 6 | ||||
-rw-r--r-- | clang/lib/AST/Interp/ByteCodeExprGen.h | 4 |
2 files changed, 5 insertions, 5 deletions
diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index cfcef06..24a33c3 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -601,8 +601,8 @@ bool ByteCodeExprGen<Emitter>::VisitComplexBinOp(const BinaryOperator *E) { const Expr *LHS = E->getLHS(); const Expr *RHS = E->getRHS(); - PrimType LHSElemT = *this->classifyComplexElementType(LHS->getType()); - PrimType RHSElemT = *this->classifyComplexElementType(RHS->getType()); + PrimType LHSElemT = this->classifyComplexElementType(LHS->getType()); + PrimType RHSElemT = this->classifyComplexElementType(RHS->getType()); unsigned LHSOffset = this->allocateLocalPrimitive(LHS, PT_Ptr, true, false); unsigned RHSOffset = this->allocateLocalPrimitive(RHS, PT_Ptr, true, false); @@ -2992,7 +2992,7 @@ bool ByteCodeExprGen<Emitter>::emitComplexReal(const Expr *SubExpr) { // Since our _Complex implementation does not map to a primitive type, // we sometimes have to do the lvalue-to-rvalue conversion here manually. if (!SubExpr->isLValue()) - return this->emitLoadPop(*classifyComplexElementType(SubExpr->getType()), + return this->emitLoadPop(classifyComplexElementType(SubExpr->getType()), SubExpr); return true; } diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.h b/clang/lib/AST/Interp/ByteCodeExprGen.h index df4cb73..63ea829 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.h +++ b/clang/lib/AST/Interp/ByteCodeExprGen.h @@ -282,12 +282,12 @@ private: } bool emitPrimCast(PrimType FromT, PrimType ToT, QualType ToQT, const Expr *E); - std::optional<PrimType> classifyComplexElementType(QualType T) const { + PrimType classifyComplexElementType(QualType T) const { assert(T->isAnyComplexType()); QualType ElemType = T->getAs<ComplexType>()->getElementType(); - return this->classify(ElemType); + return *this->classify(ElemType); } bool emitComplexReal(const Expr *SubExpr); |