From e4d34261f85050af340ade9a7dcd332f11b4485f Mon Sep 17 00:00:00 2001 From: Timm Baeder Date: Tue, 24 Sep 2024 10:18:33 +0200 Subject: [PATCH] [clang][bytecode] Ignore CPointerToObjCPointerCasts (#109760) --- clang/lib/AST/ByteCode/Compiler.cpp | 1 + clang/test/AST/ByteCode/codegen.m | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index e89863a231be..939a3aa43ff8 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -431,6 +431,7 @@ bool Compiler::VisitCastExpr(const CastExpr *CE) { case CK_NoOp: case CK_UserDefinedConversion: case CK_AddressSpaceConversion: + case CK_CPointerToObjCPointerCast: return this->delegate(SubExpr); case CK_BitCast: { diff --git a/clang/test/AST/ByteCode/codegen.m b/clang/test/AST/ByteCode/codegen.m index 08c3d9a70b36..6139596c6337 100644 --- a/clang/test/AST/ByteCode/codegen.m +++ b/clang/test/AST/ByteCode/codegen.m @@ -10,3 +10,8 @@ // // CHECK-NEXT: @.str = {{.*}}constant [13 x i8] c"Hello World!\00", section "__TEXT,__cstring,cstring_literals", align 1 id a = @"Hello World!"; + +extern void OBJC_CLASS_$_f; +Class c = (Class)&OBJC_CLASS_$_f; +// CHECK: @c ={{.*}} global ptr @"OBJC_CLASS_$_f" +// CHECK: @"OBJC_CLASS_$_f" ={{.*}} global %struct._class_t