@@ -1839,35 +1839,51 @@ class Verifier : public ASTWalker {
1839
1839
Out << " MakeTemporarilyEscapableExpr type does not match subexpression" ;
1840
1840
abort ();
1841
1841
}
1842
-
1843
- // Closure and opaque value should both be functions, with the closure
1844
- // noescape and the opaque value escapable but otherwise matching.
1845
- auto closureFnTy = E->getNonescapingClosureValue ()->getType ()
1846
- ->getAs <FunctionType>();
1847
- if (!closureFnTy) {
1848
- Out << " MakeTemporarilyEscapableExpr closure type is not a closure" ;
1842
+
1843
+ auto call = dyn_cast<CallExpr>(E->getSubExpr ());
1844
+ if (!call) {
1845
+ Out << " MakeTemporarilyEscapableExpr subexpression is not a call\n " ;
1849
1846
abort ();
1850
1847
}
1851
- auto opaqueValueFnTy = E-> getOpaqueValue ()-> getType ()
1852
- ->getAs <FunctionType>();
1853
- if (!opaqueValueFnTy ) {
1854
- Out<< " MakeTemporarilyEscapableExpr opaque value type is not a closure " ;
1848
+
1849
+ auto callFnTy = call-> getFn ()-> getType () ->getAs <FunctionType>();
1850
+ if (!callFnTy ) {
1851
+ Out << " MakeTemporarilyEscapableExpr call does not call function \n " ;
1855
1852
abort ();
1856
1853
}
1857
- if (!closureFnTy-> isNoEscape ()) {
1858
- Out << " MakeTemporarilyEscapableExpr closure type should be noescape" ;
1854
+ if (!callFnTy-> getExtInfo (). isNoEscape ()) {
1855
+ Out << " MakeTemporarilyEscapableExpr called function is not noescape\n " ;
1859
1856
abort ();
1860
1857
}
1861
- if (opaqueValueFnTy->isNoEscape ()) {
1862
- Out << " MakeTemporarilyEscapableExpr opaque value type should be "
1863
- " escaping" ;
1858
+
1859
+ auto callArgTy = call->getArg ()->getType ()->getAs <FunctionType>();
1860
+ if (!callArgTy) {
1861
+ Out << " MakeTemporarilyEscapableExpr call argument is not a function\n " ;
1862
+ abort ();
1863
+ }
1864
+
1865
+ // Closure and opaque value should both be functions, with the closure
1866
+ // noescape and the opaque value escapable but otherwise matching.
1867
+ auto closureFnTy =
1868
+ E->getNonescapingClosureValue ()->getType ()->getAs <FunctionType>();
1869
+ if (!closureFnTy) {
1870
+ Out << " MakeTemporarilyEscapableExpr closure type is not a closure\n " ;
1871
+ abort ();
1872
+ }
1873
+ auto opaqueValueFnTy =
1874
+ E->getOpaqueValue ()->getType ()->getAs <FunctionType>();
1875
+ if (!opaqueValueFnTy) {
1876
+ Out << " MakeTemporarilyEscapableExpr opaque value type is not a "
1877
+ " closure\n " ;
1864
1878
abort ();
1865
1879
}
1866
- if (!closureFnTy->isEqual (
1867
- opaqueValueFnTy->withExtInfo (opaqueValueFnTy->getExtInfo ()
1868
- .withNoEscape ()))) {
1880
+ auto closureFnNoEscape =
1881
+ closureFnTy->withExtInfo (closureFnTy->getExtInfo ().withNoEscape ());
1882
+ auto opaqueValueNoEscape = opaqueValueFnTy->withExtInfo (
1883
+ opaqueValueFnTy->getExtInfo ().withNoEscape ());
1884
+ if (!closureFnNoEscape->isEqual (opaqueValueNoEscape)) {
1869
1885
Out << " MakeTemporarilyEscapableExpr closure and opaque value type "
1870
- " don't match" ;
1886
+ " don't match\n " ;
1871
1887
abort ();
1872
1888
}
1873
1889
}
0 commit comments