From aa40b0284692bdb65a851a00f04e1458c3811542 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 20 Jul 2021 20:45:18 +0200 Subject: [PATCH] [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. --- unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp b/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp index e9d39efd344..860fc2f73fe 100644 --- a/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp +++ b/unittests/ExecutionEngine/Orc/IndirectionUtilsTest.cpp @@ -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));