Skip to content

Commit 2625554

Browse files
committed
SILArgumentConvention: fix const, add isPackParameter
1 parent 54fd18e commit 2625554

File tree

1 file changed

+25
-2
lines changed

1 file changed

+25
-2
lines changed

include/swift/SIL/SILArgumentConvention.h

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ struct SILArgumentConvention {
167167
}
168168

169169
/// Returns true if \p Value is a non-aliasing indirect parameter.
170-
bool isExclusiveIndirectParameter() {
170+
bool isExclusiveIndirectParameter() const {
171171
switch (Value) {
172172
case SILArgumentConvention::Indirect_In:
173173
case SILArgumentConvention::Indirect_Out:
@@ -190,7 +190,7 @@ struct SILArgumentConvention {
190190
}
191191

192192
/// Returns true if \p Value is an indirect-out parameter.
193-
bool isIndirectOutParameter() {
193+
bool isIndirectOutParameter() const {
194194
switch (Value) {
195195
case SILArgumentConvention::Indirect_Out:
196196
case SILArgumentConvention::Pack_Out:
@@ -211,6 +211,29 @@ struct SILArgumentConvention {
211211
}
212212
llvm_unreachable("covered switch isn't covered?!");
213213
}
214+
215+
/// Returns true if \p Value is a pack parameter.
216+
bool isPackParameter() const {
217+
switch (Value) {
218+
case SILArgumentConvention::Pack_Inout:
219+
case SILArgumentConvention::Pack_Owned:
220+
case SILArgumentConvention::Pack_Guaranteed:
221+
case SILArgumentConvention::Pack_Out:
222+
return true;
223+
224+
case SILArgumentConvention::Indirect_Out:
225+
case SILArgumentConvention::Indirect_In:
226+
case SILArgumentConvention::Indirect_In_Guaranteed:
227+
case SILArgumentConvention::Indirect_Inout:
228+
case SILArgumentConvention::Indirect_InoutAliasable:
229+
case SILArgumentConvention::Indirect_In_CXX:
230+
case SILArgumentConvention::Direct_Unowned:
231+
case SILArgumentConvention::Direct_Guaranteed:
232+
case SILArgumentConvention::Direct_Owned:
233+
return false;
234+
}
235+
llvm_unreachable("covered switch isn't covered?!");
236+
}
214237
};
215238

216239
} // namespace swift

0 commit comments

Comments
 (0)