Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-11023] Compilation failed when we pass -debug-time-function-bodies flag #53413

Open
swift-ci opened this issue Jun 26, 2019 · 6 comments
Open
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-11023
Radar None
Original Reporter Dubovkin (JIRA User)
Type Bug

Attachment: Download

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

md5: 0c2cd221c42a8712b776189a83aa3d36

Issue Description:

When we run xcodebuild with a debug-time-function-bodies flag, we got a compilation error. Without this flag project compiles without any issue.

/Users/foo/SwiftDemo/modules/VoyagerDataModel/VoyagerDataModel_Class1.swift:26:39: error: type 'NSAttributedString.Key' has no member 'foregroundColor'
_ = rangesForMissingAttribute(NSAttributedString.Key.foregroundColor, attributedText:attributedText, range: NSRangeFromString(text))

Swift: 4.2

Xcode 10.2.1
Build version 10E1001

@belkadan
Copy link
Contributor

That's definitely surprising, but it's worth noting that -debug-time-function-bodies is not a supported option.

Can you share the project? I don't think we're going to be able to reproduce this without your exact setup.

@swift-ci
Copy link
Collaborator Author

Comment by Alexey (JIRA)

For whatever reason I can't repro it anymore - everything works fine as expected and I see function timing in the output

I passes the flag as OTHER_SWIFT_FLAGS="-Xfrontend -debug-time-function-bodies" btw so it should be supported in this way.

@belkadan
Copy link
Contributor

That is how you do it, but that doesn't make it supported. Anything inside -Xfrontend is a compiler implementation detail, subject to change.

@swift-ci
Copy link
Collaborator Author

Comment by Alexey (JIRA)

Interesting! Is there any official way to pass this option to the swift compiler?

@belkadan
Copy link
Contributor

No, the option itself is not supported. As noted in the name, it's for debugging, and isn't necessarily an accurate picture of how long a function takes. It's not totally inaccurate either, though, especially for outlier expressions, so I get why people use it. cc @xedin

@belkadan
Copy link
Contributor

-Xfrontend -warn-long-function-bodies isn't supported either but at least has less of a chance of false conclusions, since people set moderately high thresholds.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants