-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Parse] 2nd attempt at multiline attribute messages (SE-200) #19219
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
Conversation
I was looking at this too, because this isn't the only place getEncodedStringSegment is being called with something that's not a direct source literal. I decided I'd rather copy the string in those cases than try to figure out all the places where getEncodedStringSegment does a one-byte lookahead (there's a bunch more besides the one you fixed). |
I'll have my PR up soon (rebuilding and running tests locally first) and I'll CC you both there. |
It’s a tricky one. At the moment multiline are allowed but processed incorrectly in attributes. getEncodedStringSegment() should respect its bounds now. |
It still doesn't here: or here: or here: or here: or here: and we'd have to do an investigating of the effect on parsing performance if we wanted to fix it. |
So we can’t assume this?
|
On my end I considered removing that assumption vs. just making a copy when the function is used outside of a normal Lexer context, and I decided the latter was safer and didn't require me to go off and test performance. |
I’ve tidied up the code a little on this PR. Can somebody perform an ASAN check on it for me please? |
ASan is currently failing on master anyway, so we'll have to wait (https://ci.swift.org/job/oss-swift-incremental-ASAN-RA-osx/). |
@swift-ci Please asan test |
@swift-ci Please test |
Build failed |
Build failed |
@swift-ci Please asan test |
@swift-ci please asan test |
1 similar comment
@swift-ci please asan test |
Rebased and ready to merge. The Asan checks seem to abort today though there was one successful run yesterday https://ci.swift.org/job/swift-PR-osx-ASAN-test/51/ before the rebase which only contained a minor header fix due to #19230. |
@swift-ci Please test |
@swift-ci Please smoke test |
@swift-ci Please ASAN test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks!
Thanks everyone. All this trouble to get multiline attribute messages working! |
Multiline string literal at attribute message position was disallowed in 59778f8. Reworked to try to at least get multiline strings working which might be useful as messages for attributes (for example a detailed “unavailable” annotation) minus the code which read off the start of the StringRef buffer.
This is a follow up on #19170 and the subsequent revert #19206 by @rintaro of some dubious code by me which attempted to support modified escaping and multiline literals for attribute messages and caused ASAN failures. Reworked to try to at least get multiline strings working which might be useful as messages for attributes (for example a detailed “unavailable” annotation) minus the code which read off the start of the StringRef buffer.
Please ASAN test before merging.
Resolves SR-8724.