llvm-project/clang/test/CodeGen/address-space-ptr32.c
Elizabeth Andrews ed5b42b741 Fix address space for function pointers with qualifier
This patch fixes a bug introduced in commit 4eaf5846d0e7. Commit
4eaf5846d0e7 sets address space of function type as program
address space unconditionally. This breaks types which have
address space qualifiers. E.g. __ptr32.

This patch fixes the bug by using address space qualifiers if
present.

Differential Revision: https://reviews.llvm.org/D119045
2022-02-07 12:53:24 -08:00

11 lines
272 B
C

// RUN: %clang_cc1 -triple x86_64-windows-msvc -fms-extensions -emit-llvm < %s | FileCheck %s
int foo(void) {
int (*__ptr32 a)(int);
return sizeof(a);
}
// CHECK: define dso_local i32 @foo
// CHECK: %a = alloca i32 (i32) addrspace(270)*, align 4
// CHECK: ret i32 4