Skip to content

[SR-9895] is_escaping_closure runtime check emits full source location in -O builds #52301

@swift-ci

Description

@swift-ci
Previous ID SR-9895
Radar None
Original Reporter pointum (JIRA User)
Type Bug
Environment

Tested with

Apple Swift version 4.2.1 (swiftlang-1000.11.42 clang-1000.11.45.1)

and

Apple Swift version 5.0 (swiftlang-1001.0.60.3 clang-1001.0.37.8)

Target: x86_64-apple-darwin18.2.0

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: fb5c7a2141981b7cdca1ce52d06c51a8

Issue Description:

Optimized (Release) builds that contain `is_escaping_closure` runtime check contain full path of a source file.

The change apparently was introduced in the following commit:

"SIL: Add an is_escaping_closure instruction"
5940796

How to test:

  • Create main.swift file with the following contents:

import AppKit; NSAnimationContext.runAnimationGroup({ _ in })

  • Compile the file with optimizations and using full path (like Xcode does during builds). E.g.:

$ swiftc -O /Users/username/Desktop/main.swift

  • Search for mentions of the file name text in the output file (main)

Expected results:

Optimized (release) build should not have full source paths

Actual results:

Optimized build contains full source path

$ strings main
v16@?0@"NSAnimationContext"8
/Users/username/Desktop/main.swift
runAnimationGroup:

Notes:

The source path is not included in the output if the `is_escaping_closure` check is not used (e.g. in -Ounchecked build or when no such closures are passed to Obj-C in the app)

Other runtime checks might have a similar issue, as I could not pinpoint relevant source changes in the commit mentioned above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions