aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-08-09 15:08:14 +0200
committerGitHub <noreply@github.com>2025-08-09 15:08:14 +0200
commitb9fef09e8e5144c9d7e43a64df6df374efc91c90 (patch)
tree713830a59cfbd4e656f09d5922bd24509bd50d4e /clang/lib/AST/ByteCode/Compiler.cpp
parent2f8e4f8b2613800b81c656b4733a85ad52b5e853 (diff)
downloadllvm-b9fef09e8e5144c9d7e43a64df6df374efc91c90.zip
llvm-b9fef09e8e5144c9d7e43a64df6df374efc91c90.tar.gz
llvm-b9fef09e8e5144c9d7e43a64df6df374efc91c90.tar.bz2
[clang][bytecode] Add canClassify() helper (#152755)
Sometimes we don't need the return value of a classsify() call, we only need to know if we can map the given Expr/Type to a primitive type. Add canClassify() for that.
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 839e39f..9db2011 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -667,8 +667,8 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *CE) {
}
case CK_VectorSplat: {
- assert(!classify(CE->getType()));
- assert(classify(SubExpr->getType()));
+ assert(!canClassify(CE->getType()));
+ assert(canClassify(SubExpr->getType()));
assert(CE->getType()->isVectorType());
if (!Initializing) {
@@ -2070,7 +2070,7 @@ bool Compiler<Emitter>::visitCallArgs(ArrayRef<const Expr *> Args,
unsigned ArgIndex = 0;
for (const Expr *Arg : Args) {
- if (OptPrimType T = classify(Arg)) {
+ if (canClassify(Arg)) {
if (!this->visit(Arg))
return false;
} else {
@@ -3155,7 +3155,7 @@ bool Compiler<Emitter>::VisitCXXNoexceptExpr(const CXXNoexceptExpr *E) {
template <class Emitter>
bool Compiler<Emitter>::VisitCXXConstructExpr(const CXXConstructExpr *E) {
QualType T = E->getType();
- assert(!classify(T));
+ assert(!canClassify(T));
if (T->isRecordType()) {
const CXXConstructorDecl *Ctor = E->getConstructor();
@@ -4150,7 +4150,7 @@ template <class Emitter> bool Compiler<Emitter>::visit(const Expr *E) {
// Create local variable to hold the return value.
if (!E->isGLValue() && !E->getType()->isAnyComplexType() &&
- !classify(E->getType())) {
+ !canClassify(E->getType())) {
std::optional<unsigned> LocalIndex = allocateLocal(E);
if (!LocalIndex)
return false;
@@ -4170,7 +4170,7 @@ template <class Emitter> bool Compiler<Emitter>::visit(const Expr *E) {
template <class Emitter>
bool Compiler<Emitter>::visitInitializer(const Expr *E) {
- assert(!classify(E->getType()));
+ assert(!canClassify(E->getType()));
OptionScope<Emitter> Scope(this, /*NewDiscardResult=*/false,
/*NewInitializing=*/true);
@@ -4377,7 +4377,7 @@ bool Compiler<Emitter>::visitZeroArrayInitializer(QualType T, const Expr *E) {
template <class Emitter>
bool Compiler<Emitter>::visitAssignment(const Expr *LHS, const Expr *RHS,
const Expr *E) {
- if (!classify(E->getType()))
+ if (!canClassify(E->getType()))
return false;
if (!this->visit(RHS))