Skip to content

Commit 13150c7

Browse files
committed
---
yaml --- r: 347645 b: refs/heads/master c: 69d189e h: refs/heads/master i: 347643: ef08b1b
1 parent c63286f commit 13150c7

File tree

3 files changed

+36
-2
lines changed

3 files changed

+36
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 34ce456cb5259eb4501a7e0acc0a21b733e08535
2+
refs/heads/master: 69d189e9f949cad3f512d83914f7c81c0f300f0b
33
refs/heads/master-next: 203b3026584ecad859eb328b2e12490099409cd5
44
refs/tags/osx-passed: b6b74147ef8a386f532cf9357a1bde006e552c54
55
refs/tags/swift-2.2-SNAPSHOT-2015-12-01-a: 6bb18e013c2284f2b45f5f84f2df2887dc0f7dea

trunk/lib/SIL/SILVerifier.cpp

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2885,11 +2885,20 @@ class SILVerifier : public SILVerifierBase<SILVerifier> {
28852885
case SILArgumentConvention::Indirect_In_Guaranteed:
28862886
return false;
28872887

2888+
case SILArgumentConvention::Indirect_InoutAliasable:
2889+
// DISCUSSION: We do not consider inout_aliasable to be "truly mutating"
2890+
// since today it is just used as a way to mark a captured argument and
2891+
// not that something truly has mutating semantics. The reason why this
2892+
// is safe is that the typechecker guarantees that if our value was
2893+
// immutable, then the use in the closure must be immutable as well.
2894+
//
2895+
// TODO: Remove this in favor of using Inout and In_Guaranteed.
2896+
return false;
2897+
28882898
case SILArgumentConvention::Indirect_Out:
28892899
case SILArgumentConvention::Indirect_In:
28902900
case SILArgumentConvention::Indirect_In_Constant:
28912901
case SILArgumentConvention::Indirect_Inout:
2892-
case SILArgumentConvention::Indirect_InoutAliasable:
28932902
return true;
28942903

28952904
case SILArgumentConvention::Direct_Unowned:

trunk/test/SIL/verifier_nofail.sil

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %target-sil-opt -enable-sil-verify-all %s
2+
3+
// This file contains a collection of tests that ensure that the verifier does
4+
// not fail on specific segments of code. The idea is to ensure that changing
5+
// the verifier does not cause these to start asserting. When one adds a new
6+
// check to the verifier, add a test case to make sure normal cases do not
7+
// crash.
8+
9+
sil_stage canonical
10+
11+
import Builtin
12+
13+
protocol P {
14+
}
15+
16+
sil @generic_user : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@inout_aliasable τ_0_0) -> ()
17+
18+
sil @open_existential_immutable_access_to_inout_aliasable : $@convention(thin) (@in_guaranteed P) -> () {
19+
bb0(%0 : $*P):
20+
%1 = open_existential_addr immutable_access %0 : $*P to $*@opened("4E16CBC0-FD9F-11E8-A311-D0817AD9F6DD") P
21+
%2 = function_ref @generic_user : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@inout_aliasable τ_0_0) -> ()
22+
apply %2<@opened("4E16CBC0-FD9F-11E8-A311-D0817AD9F6DD") P>(%1) : $@convention(thin) <τ_0_0 where τ_0_0 : P> (@inout_aliasable τ_0_0) -> ()
23+
%9999 = tuple()
24+
return %9999 : $()
25+
}

0 commit comments

Comments
 (0)