Skip to content

Commit 15565c1

Browse files
committed
Adjust for SVN r298393
1 parent a0f1e30 commit 15565c1

20 files changed

+151
-163
lines changed

lib/AST/Builtins.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ bool BuiltinInfo::isReadNone() const {
4646

4747
bool IntrinsicInfo::hasAttribute(llvm::Attribute::AttrKind Kind) const {
4848
// FIXME: We should not be relying on the global LLVM context.
49-
llvm::AttributeSet attrs
50-
= llvm::Intrinsic::getAttributes(getGlobalLLVMContext(), ID);
51-
return (attrs.hasAttribute(llvm::AttributeSet::FunctionIndex, Kind));
49+
llvm::AttributeList attrs =
50+
llvm::Intrinsic::getAttributes(getGlobalLLVMContext(), ID);
51+
return (attrs.hasAttribute(llvm::AttributeList::FunctionIndex, Kind));
5252
}
5353

5454
Type swift::getBuiltinType(ASTContext &Context, StringRef Name) {
@@ -1273,10 +1273,10 @@ getSwiftFunctionTypeForIntrinsic(unsigned iid, ArrayRef<Type> TypeArgs,
12731273
}
12741274

12751275
// Translate LLVM function attributes to Swift function attributes.
1276-
llvm::AttributeSet attrs =
1276+
llvm::AttributeList attrs =
12771277
llvm::Intrinsic::getAttributes(getGlobalLLVMContext(), ID);
12781278
Info = FunctionType::ExtInfo();
1279-
if (attrs.hasAttribute(llvm::AttributeSet::FunctionIndex,
1279+
if (attrs.hasAttribute(llvm::AttributeList::FunctionIndex,
12801280
llvm::Attribute::NoReturn))
12811281
ResultTy = Context.getNeverType();
12821282

lib/ClangImporter/ImportDecl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4223,12 +4223,12 @@ namespace {
42234223
result->setCheckedInheritanceClause();
42244224

42254225
// Add inferred attributes.
4226-
#define INFERRED_ATTRIBUTES(ModuleName, ClassName, AttributeSet) \
4227-
if (name.str().equals(#ClassName) && \
4228-
result->getParentModule()->getName().str().equals(#ModuleName)) { \
4229-
using namespace inferred_attributes; \
4230-
addInferredAttributes(result, AttributeSet); \
4231-
}
4226+
#define INFERRED_ATTRIBUTES(ModuleName, ClassName, AttributeSet) \
4227+
if (name.str().equals(#ClassName) && \
4228+
result->getParentModule()->getName().str().equals(#ModuleName)) { \
4229+
using namespace inferred_attributes; \
4230+
addInferredAttributes(result, AttributeSet); \
4231+
}
42324232
#include "InferredAttributes.def"
42334233

42344234
result->setMemberLoader(&Impl, 0);

lib/IRGen/CallEmission.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ class CallEmission {
3636

3737
private:
3838
/// The function attributes for the call.
39-
llvm::AttributeSet Attrs;
39+
llvm::AttributeList Attrs;
4040

4141
/// The builtin/special arguments to pass to the call.
4242
SmallVector<llvm::Value*, 8> Args;
@@ -57,8 +57,8 @@ class CallEmission {
5757
void emitToUnmappedExplosion(Explosion &out);
5858
llvm::CallSite emitCallSite();
5959
llvm::CallSite emitInvoke(llvm::CallingConv::ID cc, llvm::Value *fn,
60-
ArrayRef<llvm::Value*> args,
61-
const llvm::AttributeSet &attrs);
60+
ArrayRef<llvm::Value *> args,
61+
const llvm::AttributeList &attrs);
6262

6363
public:
6464
CallEmission(IRGenFunction &IGF, const Callee &callee)

lib/IRGen/GenCall.cpp

Lines changed: 26 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ static void addDereferenceableAttributeToBuilder(IRGenModule &IGM,
7676
}
7777

7878
static void addIndirectValueParameterAttributes(IRGenModule &IGM,
79-
llvm::AttributeSet &attrs,
79+
llvm::AttributeList &attrs,
8080
const TypeInfo &ti,
8181
unsigned argIndex) {
8282
llvm::AttrBuilder b;
@@ -86,14 +86,13 @@ static void addIndirectValueParameterAttributes(IRGenModule &IGM,
8686
// The parameter must reference dereferenceable memory of the type.
8787
addDereferenceableAttributeToBuilder(IGM, b, ti);
8888

89-
auto resultAttrs = llvm::AttributeSet::get(IGM.LLVMContext, argIndex+1, b);
89+
auto resultAttrs = llvm::AttributeList::get(IGM.LLVMContext, argIndex + 1, b);
9090
attrs = attrs.addAttributes(IGM.LLVMContext, argIndex+1, resultAttrs);
9191
}
9292

9393
static void addInoutParameterAttributes(IRGenModule &IGM,
94-
llvm::AttributeSet &attrs,
95-
const TypeInfo &ti,
96-
unsigned argIndex,
94+
llvm::AttributeList &attrs,
95+
const TypeInfo &ti, unsigned argIndex,
9796
bool aliasable) {
9897
llvm::AttrBuilder b;
9998
// Aliasing inouts is unspecified, but we still want aliasing to be memory-
@@ -103,7 +102,7 @@ static void addInoutParameterAttributes(IRGenModule &IGM,
103102
// The inout must reference dereferenceable memory of the type.
104103
addDereferenceableAttributeToBuilder(IGM, b, ti);
105104

106-
auto resultAttrs = llvm::AttributeSet::get(IGM.LLVMContext, argIndex+1, b);
105+
auto resultAttrs = llvm::AttributeList::get(IGM.LLVMContext, argIndex + 1, b);
107106
attrs = attrs.addAttributes(IGM.LLVMContext, argIndex+1, resultAttrs);
108107
}
109108

@@ -133,9 +132,8 @@ llvm::CallingConv::ID irgen::expandCallingConv(IRGenModule &IGM,
133132
}
134133

135134
static void addIndirectResultAttributes(IRGenModule &IGM,
136-
llvm::AttributeSet &attrs,
137-
unsigned paramIndex,
138-
bool allowSRet) {
135+
llvm::AttributeList &attrs,
136+
unsigned paramIndex, bool allowSRet) {
139137
static const llvm::Attribute::AttrKind attrKindsWithSRet[] = {
140138
llvm::Attribute::StructRet,
141139
llvm::Attribute::NoAlias,
@@ -145,26 +143,26 @@ static void addIndirectResultAttributes(IRGenModule &IGM,
145143
llvm::Attribute::NoAlias,
146144
llvm::Attribute::NoCapture,
147145
};
148-
auto resultAttrs =
149-
llvm::AttributeSet::get(IGM.LLVMContext, paramIndex + 1,
150-
(allowSRet ? makeArrayRef(attrKindsWithSRet)
151-
: makeArrayRef(attrKindsWithoutSRet)));
146+
auto resultAttrs = llvm::AttributeList::get(
147+
IGM.LLVMContext, paramIndex + 1,
148+
(allowSRet ? makeArrayRef(attrKindsWithSRet)
149+
: makeArrayRef(attrKindsWithoutSRet)));
152150
attrs = attrs.addAttributes(IGM.LLVMContext, paramIndex + 1, resultAttrs);
153151
}
154152

155-
void IRGenModule::addSwiftSelfAttributes(llvm::AttributeSet &attrs,
153+
void IRGenModule::addSwiftSelfAttributes(llvm::AttributeList &attrs,
156154
unsigned argIndex) {
157155
if (!UseSwiftCC)
158156
return;
159157
static const llvm::Attribute::AttrKind attrKinds[] = {
160158
llvm::Attribute::SwiftSelf,
161159
};
162160
auto argAttrs =
163-
llvm::AttributeSet::get(this->LLVMContext, argIndex + 1, attrKinds);
161+
llvm::AttributeList::get(this->LLVMContext, argIndex + 1, attrKinds);
164162
attrs = attrs.addAttributes(this->LLVMContext, argIndex + 1, argAttrs);
165163
}
166164

167-
void IRGenModule::addSwiftErrorAttributes(llvm::AttributeSet &attrs,
165+
void IRGenModule::addSwiftErrorAttributes(llvm::AttributeList &attrs,
168166
unsigned argIndex) {
169167
// Don't add the swifterror attribute on ABI that don't pass it in a register.
170168
// We create a shadow stack location of the swifterror parameter for the
@@ -177,33 +175,31 @@ void IRGenModule::addSwiftErrorAttributes(llvm::AttributeSet &attrs,
177175
llvm::Attribute::SwiftError,
178176
};
179177
auto argAttrs =
180-
llvm::AttributeSet::get(this->LLVMContext, argIndex + 1, attrKinds);
178+
llvm::AttributeList::get(this->LLVMContext, argIndex + 1, attrKinds);
181179
attrs = attrs.addAttributes(this->LLVMContext, argIndex + 1, argAttrs);
182180
}
183181

184182
void irgen::addByvalArgumentAttributes(IRGenModule &IGM,
185-
llvm::AttributeSet &attrs,
186-
unsigned argIndex,
187-
Alignment align) {
183+
llvm::AttributeList &attrs,
184+
unsigned argIndex, Alignment align) {
188185
llvm::AttrBuilder b;
189186
b.addAttribute(llvm::Attribute::ByVal);
190187
b.addAttribute(llvm::Attribute::getWithAlignment(IGM.LLVMContext,
191188
align.getValue()));
192-
auto resultAttrs = llvm::AttributeSet::get(IGM.LLVMContext, argIndex+1, b);
189+
auto resultAttrs = llvm::AttributeList::get(IGM.LLVMContext, argIndex + 1, b);
193190
attrs = attrs.addAttributes(IGM.LLVMContext,
194191
argIndex+1,
195192
resultAttrs);
196193
}
197194

198-
void irgen::addExtendAttribute(IRGenModule &IGM,
199-
llvm::AttributeSet &attrs,
195+
void irgen::addExtendAttribute(IRGenModule &IGM, llvm::AttributeList &attrs,
200196
unsigned index, bool signExtend) {
201197
llvm::AttrBuilder b;
202198
if (signExtend)
203199
b.addAttribute(llvm::Attribute::SExt);
204200
else
205201
b.addAttribute(llvm::Attribute::ZExt);
206-
auto resultAttrs = llvm::AttributeSet::get(IGM.LLVMContext, index, b);
202+
auto resultAttrs = llvm::AttributeList::get(IGM.LLVMContext, index, b);
207203
attrs = attrs.addAttributes(IGM.LLVMContext, index, resultAttrs);
208204
}
209205

@@ -213,7 +209,7 @@ namespace {
213209
CanSILFunctionType FnType;
214210
public:
215211
SmallVector<llvm::Type*, 8> ParamIRTypes;
216-
llvm::AttributeSet Attrs;
212+
llvm::AttributeList Attrs;
217213
ForeignFunctionInfo ForeignInfo;
218214
bool CanUseSRet = true;
219215
bool CanUseError = true;
@@ -902,7 +898,7 @@ llvm::Type *SignatureExpansion::expandExternalSignatureTypes() {
902898
bool signExt = clangResultTy->hasSignedIntegerRepresentation();
903899
assert((signExt || clangResultTy->hasUnsignedIntegerRepresentation()) &&
904900
"Invalid attempt to add extension attribute to argument!");
905-
addExtendAttribute(IGM, Attrs, llvm::AttributeSet::ReturnIndex, signExt);
901+
addExtendAttribute(IGM, Attrs, llvm::AttributeList::ReturnIndex, signExt);
906902
}
907903

908904
// If we return indirectly, that is the first parameter type.
@@ -1305,8 +1301,8 @@ void CallEmission::emitToUnmappedMemory(Address result) {
13051301
// FIXME: This doesn't belong on IGF.
13061302
llvm::CallSite CallEmission::emitInvoke(llvm::CallingConv::ID convention,
13071303
llvm::Value *fn,
1308-
ArrayRef<llvm::Value*> args,
1309-
const llvm::AttributeSet &attrs) {
1304+
ArrayRef<llvm::Value *> args,
1305+
const llvm::AttributeList &attrs) {
13101306
// TODO: exceptions!
13111307
llvm::CallInst *call = IGF.Builder.CreateCall(fn, args);
13121308
call->setAttributes(attrs);
@@ -1339,9 +1335,8 @@ llvm::CallSite CallEmission::emitCallSite() {
13391335
Args[i] = IGF.coerceValue(Args[i], paramTy, IGF.IGM.DataLayout);
13401336
}
13411337

1342-
llvm::CallSite call = emitInvoke(cc, fnPtr, Args,
1343-
llvm::AttributeSet::get(fnPtr->getContext(),
1344-
Attrs));
1338+
llvm::CallSite call = emitInvoke(
1339+
cc, fnPtr, Args, llvm::AttributeList::get(fnPtr->getContext(), Attrs));
13451340
Args.clear();
13461341

13471342
// Return.

lib/IRGen/GenCall.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#include "llvm/IR/CallingConv.h"
2525

2626
namespace llvm {
27-
class AttributeSet;
27+
class AttributeList;
2828
class Twine;
2929
class Type;
3030
class Value;
@@ -70,15 +70,15 @@ namespace irgen {
7070

7171
/// Add function attributes to an attribute set for a byval argument.
7272
void addByvalArgumentAttributes(IRGenModule &IGM,
73-
llvm::AttributeSet &attrs,
73+
llvm::AttributeList &attrs,
7474
unsigned argIndex,
7575
Alignment align);
7676

7777
/// Add signext or zeroext attribute set for an argument that needs
7878
/// extending.
79-
void addExtendAttribute(IRGenModule &IGM, llvm::AttributeSet &attrs,
79+
void addExtendAttribute(IRGenModule &IGM, llvm::AttributeList &attrs,
8080
unsigned index, bool signExtend);
81-
81+
8282
/// Can a series of values be simply pairwise coerced to (or from) an
8383
/// explosion schema, or do they need to traffic through memory?
8484
bool canCoerceToSchema(IRGenModule &IGM,

lib/IRGen/GenDecl.cpp

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,7 +1452,7 @@ static bool isPointerTo(llvm::Type *ptrTy, llvm::Type *objTy) {
14521452
llvm::Function *LinkInfo::createFunction(IRGenModule &IGM,
14531453
llvm::FunctionType *fnType,
14541454
llvm::CallingConv::ID cc,
1455-
const llvm::AttributeSet &attrs,
1455+
const llvm::AttributeList &attrs,
14561456
llvm::Function *insertBefore) {
14571457
llvm::Function *existing = IGM.Module.getFunction(getName());
14581458
if (existing) {
@@ -1480,8 +1480,8 @@ llvm::Function *LinkInfo::createFunction(IRGenModule &IGM,
14801480

14811481
auto initialAttrs = IGM.constructInitialAttributes();
14821482
// Merge initialAttrs with attrs.
1483-
auto updatedAttrs = attrs.addAttributes(IGM.getLLVMContext(),
1484-
llvm::AttributeSet::FunctionIndex, initialAttrs);
1483+
auto updatedAttrs = attrs.addAttributes(
1484+
IGM.getLLVMContext(), llvm::AttributeList::FunctionIndex, initialAttrs);
14851485
if (!updatedAttrs.isEmpty())
14861486
fn->setAttributes(updatedAttrs);
14871487

@@ -1805,7 +1805,7 @@ llvm::Function *IRGenModule::getAddrOfSILFunction(SILFunction *f,
18051805
IRGen.addLazyFunction(f);
18061806
}
18071807

1808-
llvm::AttributeSet attrs;
1808+
llvm::AttributeList attrs;
18091809
llvm::FunctionType *fnType = getFunctionType(f->getLoweredFunctionType(),
18101810
attrs);
18111811

@@ -1814,11 +1814,13 @@ llvm::Function *IRGenModule::getAddrOfSILFunction(SILFunction *f,
18141814

18151815
if (f->getInlineStrategy() == NoInline) {
18161816
attrs = attrs.addAttribute(fnType->getContext(),
1817-
llvm::AttributeSet::FunctionIndex, llvm::Attribute::NoInline);
1817+
llvm::AttributeList::FunctionIndex,
1818+
llvm::Attribute::NoInline);
18181819
}
18191820
if (isReadOnlyFunction(f)) {
18201821
attrs = attrs.addAttribute(fnType->getContext(),
1821-
llvm::AttributeSet::FunctionIndex, llvm::Attribute::ReadOnly);
1822+
llvm::AttributeList::FunctionIndex,
1823+
llvm::Attribute::ReadOnly);
18221824
}
18231825
fn = link.createFunction(*this, fnType, cc, attrs, insertBefore);
18241826

@@ -2442,7 +2444,7 @@ IRGenModule::getAddrOfTypeMetadataAccessFunction(CanType type,
24422444

24432445
auto fnType = llvm::FunctionType::get(TypeMetadataPtrTy, false);
24442446
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
2445-
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeSet());
2447+
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeList());
24462448
return entry;
24472449
}
24482450

@@ -2467,7 +2469,7 @@ IRGenModule::getAddrOfGenericTypeMetadataAccessFunction(
24672469

24682470
auto fnType = llvm::FunctionType::get(TypeMetadataPtrTy, genericArgs, false);
24692471
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
2470-
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeSet());
2472+
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeList());
24712473
return entry;
24722474
}
24732475

@@ -2784,7 +2786,7 @@ llvm::Function *IRGenModule::getAddrOfValueWitness(CanType abstractType,
27842786
cast<llvm::PointerType>(getValueWitnessTy(index))
27852787
->getElementType());
27862788
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
2787-
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeSet());
2789+
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeList());
27882790
return entry;
27892791
}
27902792

@@ -3119,7 +3121,7 @@ IRGenModule::getAddrOfGenericWitnessTableInstantiationFunction(
31193121
Int8PtrPtrTy },
31203122
/*varargs*/ false);
31213123
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
3122-
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeSet());
3124+
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeList());
31233125
return entry;
31243126
}
31253127

@@ -3167,7 +3169,7 @@ IRGenModule::getAddrOfWitnessTableAccessFunction(
31673169
}
31683170

31693171
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
3170-
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeSet());
3172+
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeList());
31713173
return entry;
31723174
}
31733175

@@ -3189,7 +3191,7 @@ IRGenModule::getAddrOfWitnessTableLazyAccessFunction(
31893191
= llvm::FunctionType::get(WitnessTablePtrTy, false);
31903192

31913193
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
3192-
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeSet());
3194+
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeList());
31933195
return entry;
31943196
}
31953197

@@ -3240,7 +3242,7 @@ IRGenModule::getAddrOfAssociatedTypeMetadataAccessFunction(
32403242

32413243
auto fnType = getAssociatedTypeMetadataAccessFunctionTy();
32423244
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
3243-
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeSet());
3245+
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeList());
32443246
return entry;
32453247
}
32463248

@@ -3263,7 +3265,7 @@ IRGenModule::getAddrOfAssociatedTypeWitnessTableAccessFunction(
32633265

32643266
auto fnType = getAssociatedTypeWitnessTableAccessFunctionTy();
32653267
LinkInfo link = LinkInfo::get(*this, entity, forDefinition);
3266-
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeSet());
3268+
entry = link.createFunction(*this, fnType, DefaultCC, llvm::AttributeList());
32673269
return entry;
32683270
}
32693271

lib/IRGen/GenEnum.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,9 +3239,9 @@ namespace {
32393239
auto call = IGF.Builder.CreateCall(IGF.IGM.getGetEnumCaseMultiPayloadFn(),
32403240
{addr.getAddress(), metadata});
32413241
call->setDoesNotThrow();
3242-
call->addAttribute(llvm::AttributeSet::FunctionIndex,
3242+
call->addAttribute(llvm::AttributeList::FunctionIndex,
32433243
llvm::Attribute::ReadOnly);
3244-
3244+
32453245
return call;
32463246
}
32473247

0 commit comments

Comments
 (0)