Skip to content

Honor #sourceLocation filenames in serialized diagnostics #19022

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 2 commits into from
Aug 29, 2018

Conversation

jrose-apple
Copy link
Contributor

I'm not sure why we never handled this. Oops.

rdar://problem/43647151

I'm not sure why we never handled this. Oops.

rdar://problem/43647151
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Contributor

@CodaFi CodaFi left a comment

Choose a reason for hiding this comment

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

LGTM. Could you add a short test that uses -vfsoverlay in a follow-up?

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

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

Woah. How did we miss this for so long?

@jrose-apple
Copy link
Contributor Author

Source compat run here

@CodaFi How's this version?

@swift-ci Please test

@swift-ci
Copy link
Contributor

Build failed
Swift Test OS X Platform
Git Sha - 0d054fb

@CodaFi
Copy link
Contributor

CodaFi commented Aug 28, 2018

Looks great, thanks!

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 0d054fb

@swift-ci
Copy link
Contributor

Build failed
Swift Test Linux Platform
Git Sha - 0d054fb

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test Linux

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Contributor

@davidungar davidungar left a comment

Choose a reason for hiding this comment

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

I don't really know enough about virtual files. What other places where we use getIdentifierForBuffer should be changed?

@@ -497,7 +497,7 @@ emitDiagnosticMessage(SourceManager &SM,

StringRef filename = "";
if (Loc.isValid())
filename = SM.getIdentifierForBuffer(SM.findBufferContainingLoc(Loc));
filename = SM.getDisplayNameForLoc(Loc);
Copy link
Contributor

Choose a reason for hiding this comment

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

Ouch! More complexity around filenames, not your fault--I'm just winging!

@jrose-apple
Copy link
Contributor Author

What other places where we use getIdentifierForBuffer should be changed?

Good question, and I feel bad for not thinking of it. I found a few more and I'll fix them in a follow-up PR.

@CodaFi
Copy link
Contributor

CodaFi commented Aug 28, 2018

What other places where we use getIdentifierForBuffer should be changed?

Probably

SILGenFunction::emitSourceLocationArgs
GroupNameCollectorFromJson::getGroupNameInternal
MappingTraits<SourceLoc>::mapping

@davidungar
Copy link
Contributor

Tx. Hmmm...How about adding to the Doxygen comment to getDisplayNameForLocation and/or getIdentifierForBuffer explaining when it is appropriate to call one instead of the other? I'm worried that a future developer might add code calling the wrong one.

@jrose-apple jrose-apple merged commit 010408f into swiftlang:master Aug 29, 2018
@jrose-apple jrose-apple deleted the diagonal branch August 29, 2018 00:21
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.

5 participants