Author: Vlastimil Labsky Date: 2020-04-01T21:08:37+13:00 New Revision: 57fd86de879cf2b4c7001b6d0a09df60877ce24d
URL: https://github.com/llvm/llvm-project/commit/57fd86de879cf2b4c7001b6d0a09df60877ce24d DIFF: https://github.com/llvm/llvm-project/commit/57fd86de879cf2b4c7001b6d0a09df60877ce24d.diff LOG: [AVR] Fix function pointer address space Summary: Function pointers should be created with program address space. This fixes function pointers on AVR. Reviewers: dylanmckay Reviewed By: dylanmckay Subscribers: Jim, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D77119 Added: Modified: clang/lib/CodeGen/CodeGenTypes.cpp Removed: ################################################################################ diff --git a/clang/lib/CodeGen/CodeGenTypes.cpp b/clang/lib/CodeGen/CodeGenTypes.cpp index befd80de96f0..29adc2c7adb3 100644 --- a/clang/lib/CodeGen/CodeGenTypes.cpp +++ b/clang/lib/CodeGen/CodeGenTypes.cpp @@ -595,7 +595,11 @@ llvm::Type *CodeGenTypes::ConvertType(QualType T) { llvm::Type *PointeeType = ConvertTypeForMem(ETy); if (PointeeType->isVoidTy()) PointeeType = llvm::Type::getInt8Ty(getLLVMContext()); - unsigned AS = Context.getTargetAddressSpace(ETy); + + unsigned AS = PointeeType->isFunctionTy() + ? getDataLayout().getProgramAddressSpace() + : Context.getTargetAddressSpace(ETy); + ResultType = llvm::PointerType::get(PointeeType, AS); break; } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits