https://github.com/y-Adrian updated https://github.com/llvm/llvm-project/pull/163839
>From a1a3bf9cb5850ae134c33aee3f3c916ffc525335 Mon Sep 17 00:00:00 2001 From: Adrian <[email protected]> Date: Fri, 17 Oct 2025 01:56:33 +0800 Subject: [PATCH] [CIR]llvm#163601:handle function type --- clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp | 3 +-- clang/test/CIR/CodeGen/throws.cpp | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp index 88fedf1acc6a1..841d4898d1d7e 100644 --- a/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp +++ b/clang/lib/CIR/CodeGen/CIRGenItaniumCXXABI.cpp @@ -957,8 +957,7 @@ const char *vTableClassNameForType(const CIRGenModule &cgm, const Type *ty) { case Type::FunctionNoProto: case Type::FunctionProto: - cgm.errorNYI("VTableClassNameForType: __function_type_info"); - break; + return "_ZTVN10__cxxabiv120__function_type_infoE"; case Type::Enum: return "_ZTVN10__cxxabiv116__enum_type_infoE"; diff --git a/clang/test/CIR/CodeGen/throws.cpp b/clang/test/CIR/CodeGen/throws.cpp index 53af1efc22cd4..24c16be238d59 100644 --- a/clang/test/CIR/CodeGen/throws.cpp +++ b/clang/test/CIR/CodeGen/throws.cpp @@ -244,3 +244,19 @@ void throw_enum_class_expr() { // OGCG: store i32 0, ptr %[[EXCEPTION_ADDR]], align 16 // OGCG: call void @__cxa_throw(ptr %[[EXCEPTION_ADDR]], ptr @_ZTIZ21throw_enum_class_exprvE4Test, ptr null) // OGCG: unreachable + +void throw_func_prototype_type() { + typedef int FuncProto(int, double); + FuncProto* fptr = nullptr; + throw fptr; +} + +void throw_func_no_prototype_type() { + typedef void FuncNoProto(); + FuncNoProto* fptr = nullptr; + throw fptr; +} + +// CIR: @_ZTVN10__cxxabiv120__function_type_infoE +// LLVM: @_ZTVN10__cxxabiv120__function_type_infoE +// OGCG: @_ZTVN10__cxxabiv120__function_type_infoE \ No newline at end of file _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
