[clang] 03ff69f - [clang][bytecode] Do pointer-to-bool convesions without classify() (#221516)

via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 5 22:23:45 PDT 2026


Author: Timm Baeder
Date: 2026-09-06T07:23:40+02:00
New Revision: 03ff69fd5f82a7607113b83e45bd3828842669e3

URL: https://github.com/llvm/llvm-project/commit/03ff69fd5f82a7607113b83e45bd3828842669e3
DIFF: https://github.com/llvm/llvm-project/commit/03ff69fd5f82a7607113b83e45bd3828842669e3.diff

LOG: [clang][bytecode] Do pointer-to-bool convesions without classify() (#221516)

Added: 
    

Modified: 
    clang/lib/AST/ByteCode/Compiler.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 03f9478a6e4e0..c99f2affc6824 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -851,13 +851,14 @@ bool Compiler<Emitter>::VisitCastExpr(const CastExpr *E) {
   }
 
   case CK_PointerToBoolean:
-  case CK_MemberPointerToBoolean: {
-    PrimType PtrT = classifyPrim(SubExpr->getType());
+    if (!this->visit(SubExpr))
+      return false;
+    return this->emitIsNonNullPtr(E);
 
+  case CK_MemberPointerToBoolean:
     if (!this->visit(SubExpr))
       return false;
-    return this->emitIsNonNull(PtrT, E);
-  }
+    return this->emitIsNonNullMemberPtr(E);
 
   case CK_IntegralComplexToBoolean:
   case CK_FloatingComplexToBoolean: {


        


More information about the cfe-commits mailing list