Skip to content

[DiagnosticVerifier] Explicitly convert a StringRef into a std::string. #30973

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

Merged
merged 1 commit into from
Apr 11, 2020
Merged

[DiagnosticVerifier] Explicitly convert a StringRef into a std::string. #30973

merged 1 commit into from
Apr 11, 2020

Conversation

enferex
Copy link

@enferex enferex commented Apr 11, 2020

The newer llvm StringRef library has removed the implicit StringRef to
std::string conversion. (See: llvm/llvm-project@adcd026)

This patch also uses a StringRef to compare another StringRef
eliminating the need to perform a StringRef to std::string conversion.

I am concerned that StringRef's are being stored in
ExpectedEducationalNotes, but as long as the StringRef does not out live
the definition this is totally cool then. (cc: @owenv)

(I do not have privs so I cannot run the tests).

The newer llvm StringRef library has removed the implicit StringRef to
std::string conversion.  (See: llvm/llvm-project@adcd026)

This patch also uses a StringRef to compare another StringRef
eliminating the need to perform a StringRef to std::string conversion.
I am concerned that StringRef's are being stored in
ExpectedEducationalNotes, but as long as the StringRef does not out live
the definition this is totally cool then.
Copy link
Contributor

@owenv owenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

The StringRefs in ExpectedEducationalNotes point into the source buffer being verified, so they won't outlive it, we use a similar pattern elsewhere in the verifier.

@owenv
Copy link
Contributor

owenv commented Apr 11, 2020

@swift-ci please smoke test

@enferex
Copy link
Author

enferex commented Apr 11, 2020

Thanks!

The StringRefs in ExpectedEducationalNotes point into the source buffer being verified, so they won't outlive it, we use a similar pattern elsewhere in the verifier.

Fantastic! Thanks for the info and the approval.

@enferex
Copy link
Author

enferex commented Apr 11, 2020

It looks like the failure for the Windows test is not related (there was a previous failure prior to testing this patch: https://ci-external.swift.org/job/swift-PR-windows/1594/console)).

@owenv
Copy link
Contributor

owenv commented Apr 11, 2020

Windows failure should be fixed now.

@swift-ci please test Windows platform

@owenv owenv merged commit cdd06d3 into swiftlang:master Apr 11, 2020
@enferex enferex deleted the explicit-stringref-to-string branch April 11, 2020 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants