1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-21 18:22:53 +01:00

[Orc] Fix sret/byval attributes in test (NFC)

This was placing sret/byval attributes without type argument on
non-pointer arguments. Make this valid IR by using pointer
arguments and passing the corresponding attribute type argument.
This commit is contained in:
Nikita Popov 2021-07-20 20:45:18 +02:00
parent 23d5a10c04
commit aa40b02846

View File

@ -18,17 +18,17 @@ namespace {
TEST(IndirectionUtilsTest, MakeStub) {
LLVMContext Context;
ModuleBuilder MB(Context, "x86_64-apple-macosx10.10", "");
StructType *ArgTy = getDummyStructTy(Context);
Type *ArgPtrTy = PointerType::getUnqual(ArgTy);
FunctionType *FTy = FunctionType::get(
Type::getVoidTy(Context),
{getDummyStructTy(Context), getDummyStructTy(Context)}, false);
Type::getVoidTy(Context), {ArgPtrTy, ArgPtrTy}, false);
Function *F = MB.createFunctionDecl(FTy, "");
AttributeSet FnAttrs = AttributeSet::get(
Context, AttrBuilder().addAttribute(Attribute::NoUnwind));
AttributeSet RetAttrs; // None
AttributeSet ArgAttrs[2] = {
AttributeSet::get(Context,
AttrBuilder().addAttribute(Attribute::StructRet)),
AttributeSet::get(Context, AttrBuilder().addAttribute(Attribute::ByVal)),
AttributeSet::get(Context, AttrBuilder().addStructRetAttr(ArgTy)),
AttributeSet::get(Context, AttrBuilder().addByValAttr(ArgTy)),
};
F->setAttributes(AttributeList::get(Context, FnAttrs, RetAttrs, ArgAttrs));