SILOptimizer: Re-implement NPCR diagnostics in SIL pass

This fixes a test involving transitive captures of local functions,
as well as an infinite recursion possible with the old code.

Fixes <rdar://problem/34496304>.
This commit is contained in:
Slava Pestov
2019-04-09 16:36:01 -04:00
parent 6a34ed0120
commit e2cb0572fe
3 changed files with 115 additions and 0 deletions

View File

@@ -137,6 +137,12 @@ NOTE(value_captured_here,none,"captured here", ())
NOTE(value_captured_transitively,none,
"captured indirectly by this call", ())
ERROR(err_noescape_param_call,none,
"passing a %select{|closure which captures a }1non-escaping function "
"parameter %0 to a call to a non-escaping function parameter can allow "
"re-entrant modification of a variable",
(DeclName, unsigned))
// Definite initialization diagnostics.
NOTE(variable_defined_here,none,
"%select{variable|constant}0 defined here", (bool))