@@ -1879,35 +1879,51 @@ class Verifier : public ASTWalker {
1879
1879
Out << " MakeTemporarilyEscapableExpr type does not match subexpression" ;
1880
1880
abort ();
1881
1881
}
1882
-
1883
- // Closure and opaque value should both be functions, with the closure
1884
- // noescape and the opaque value escapable but otherwise matching.
1885
- auto closureFnTy = E->getNonescapingClosureValue ()->getType ()
1886
- ->getAs <FunctionType>();
1887
- if (!closureFnTy) {
1888
- Out << " MakeTemporarilyEscapableExpr closure type is not a closure" ;
1882
+
1883
+ auto call = dyn_cast<CallExpr>(E->getSubExpr ());
1884
+ if (!call) {
1885
+ Out << " MakeTemporarilyEscapableExpr subexpression is not a call\n " ;
1889
1886
abort ();
1890
1887
}
1891
- auto opaqueValueFnTy = E-> getOpaqueValue ()-> getType ()
1892
- ->getAs <FunctionType>();
1893
- if (!opaqueValueFnTy ) {
1894
- Out<< " MakeTemporarilyEscapableExpr opaque value type is not a closure " ;
1888
+
1889
+ auto callFnTy = call-> getFn ()-> getType () ->getAs <FunctionType>();
1890
+ if (!callFnTy ) {
1891
+ Out << " MakeTemporarilyEscapableExpr call does not call function \n " ;
1895
1892
abort ();
1896
1893
}
1897
- if (!closureFnTy-> isNoEscape ()) {
1898
- Out << " MakeTemporarilyEscapableExpr closure type should be noescape" ;
1894
+ if (!callFnTy-> getExtInfo (). isNoEscape ()) {
1895
+ Out << " MakeTemporarilyEscapableExpr called function is not noescape\n " ;
1899
1896
abort ();
1900
1897
}
1901
- if (opaqueValueFnTy->isNoEscape ()) {
1902
- Out << " MakeTemporarilyEscapableExpr opaque value type should be "
1903
- " escaping" ;
1898
+
1899
+ auto callArgTy = call->getArg ()->getType ()->getAs <FunctionType>();
1900
+ if (!callArgTy) {
1901
+ Out << " MakeTemporarilyEscapableExpr call argument is not a function\n " ;
1902
+ abort ();
1903
+ }
1904
+
1905
+ // Closure and opaque value should both be functions, with the closure
1906
+ // noescape and the opaque value escapable but otherwise matching.
1907
+ auto closureFnTy =
1908
+ E->getNonescapingClosureValue ()->getType ()->getAs <FunctionType>();
1909
+ if (!closureFnTy) {
1910
+ Out << " MakeTemporarilyEscapableExpr closure type is not a closure\n " ;
1911
+ abort ();
1912
+ }
1913
+ auto opaqueValueFnTy =
1914
+ E->getOpaqueValue ()->getType ()->getAs <FunctionType>();
1915
+ if (!opaqueValueFnTy) {
1916
+ Out << " MakeTemporarilyEscapableExpr opaque value type is not a "
1917
+ " closure\n " ;
1904
1918
abort ();
1905
1919
}
1906
- if (!closureFnTy->isEqual (
1907
- opaqueValueFnTy->withExtInfo (opaqueValueFnTy->getExtInfo ()
1908
- .withNoEscape ()))) {
1920
+ auto closureFnNoEscape =
1921
+ closureFnTy->withExtInfo (closureFnTy->getExtInfo ().withNoEscape ());
1922
+ auto opaqueValueNoEscape = opaqueValueFnTy->withExtInfo (
1923
+ opaqueValueFnTy->getExtInfo ().withNoEscape ());
1924
+ if (!closureFnNoEscape->isEqual (opaqueValueNoEscape)) {
1909
1925
Out << " MakeTemporarilyEscapableExpr closure and opaque value type "
1910
- " don't match" ;
1926
+ " don't match\n " ;
1911
1927
abort ();
1912
1928
}
1913
1929
}
0 commit comments