Author: Timm Baeder Date: 2025-08-21T20:01:22+02:00 New Revision: 8b091961b134661a3bbc95646a3a9b2344d684f8
URL: https://github.com/llvm/llvm-project/commit/8b091961b134661a3bbc95646a3a9b2344d684f8 DIFF: https://github.com/llvm/llvm-project/commit/8b091961b134661a3bbc95646a3a9b2344d684f8.diff LOG: [clang][bytecode] Implement Pointer::getType() for function pointers (#154788) Fixes #152920 Added: Modified: clang/lib/AST/ByteCode/Pointer.h clang/test/AST/ByteCode/functions.cpp Removed: ################################################################################ diff --git a/clang/lib/AST/ByteCode/Pointer.h b/clang/lib/AST/ByteCode/Pointer.h index f310c8a7b66be..0ce54ab0a17df 100644 --- a/clang/lib/AST/ByteCode/Pointer.h +++ b/clang/lib/AST/ByteCode/Pointer.h @@ -341,6 +341,8 @@ class Pointer { QualType getType() const { if (isTypeidPointer()) return QualType(Typeid.TypeInfoType, 0); + if (isFunctionPointer()) + return asFunctionPointer().getFunction()->getDecl()->getType(); if (inPrimitiveArray() && Offset != asBlockPointer().Base) { // Unfortunately, complex and vector types are not array types in clang, diff --git a/clang/test/AST/ByteCode/functions.cpp b/clang/test/AST/ByteCode/functions.cpp index 4f090842510e0..01bf0a55bd19a 100644 --- a/clang/test/AST/ByteCode/functions.cpp +++ b/clang/test/AST/ByteCode/functions.cpp @@ -732,3 +732,8 @@ namespace LocalVarForParmVarDecl { } static_assert(foo(), ""); } + +namespace PtrPtrCast { + void foo() { ; } + void bar(int *a) { a = (int *)(void *)(foo); } +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits