-
Notifications
You must be signed in to change notification settings - Fork 10.6k
[DebugInfo] Use Stmt EndLoc if SILLocation passed in is the Stmt EndLoc. #79833
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
|
@swift-ci please smoke test Linux |
|
@swift-ci please smoke test macOS |
|
@swift-ci please test Windows |
|
Please test with following pull request: @swift-ci Please smoke test Linux |
felipepiovezan
left a comment
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.
@adrian-prantl probably understands this code a bit better, so I'll let him do the honors. I'm not familiar with this integer in the AST node
c87bd7f to
a1570c5
Compare
|
Please test with following pull request: @swift-ci Please smoke test Linux |
|
Please test with following pull request: @swift-ci Please smoke test macOS |
|
Please test with following pull request: @swift-ci Please test Windows |
a1570c5 to
e6a121b
Compare
|
Please test with following pull request: @swift-ci Please smoke test Linux |
|
Please test with following pull request: @swift-ci Please smoke test macOS |
|
Please test with following pull request: @swift-ci Please test Windows |
|
@swift-ci please smoke test macOS |
When creating an ExtendedASTNodeLoc from a SILLocation, if the SILLocation passed in belongs to a swift::Stmt, we only ever use the Stmt's StartLoc for the SourceLocation. If the SILLocation passed in, has a SourceLocation that matches the EndLoc of the Stmt, we should correctly set the primary ASTNodeTy PointerUnion's integer to 1, to denote that the SourceLocation dervied from the Stmt points to the EndLoc.
e6a121b to
7a6070e
Compare
|
Please test with following pull request: @swift-ci Please smoke test Linux |
|
Please test with following pull request: @swift-ci Please smoke test macOS |
|
Please test with following pull request: @swift-ci Please test Windows |
When creating an ExtendedASTNodeLoc from a SILLocation, if the SILLocation passed in belongs to a swift::Stmt, we only ever use the Stmt's StartLoc for the SourceLocation. If the SILLocation passed in, has a SourceLocation that matches the EndLoc of the Stmt, we should correctly set the primary ASTNodeTy PointerIntPair's integer to 1, to denote that the SourceLocation dervied from the Stmt points to the EndLoc.
To explain a little more:
When we emit a
hop_to_executioninstruction in SIL, we callRegularLocation::getDebugOnlyLocationon the SILLocation being passed in, which callsRegularLocation::getDebugOnlyExtendedASTNodeLoc. This function will create anExtendedASTNodeLocwhich has two AST locations, a primary location and one used for debugging:If we look at how a
SourceLocis derived from aSILLocationwe can see that theSILLocation::getSourceLocalways callsgetStartLocif the pointer theASTNodeTyholds is aswift::Stmt*, unless theSILLocation::pointsToEndfunction returns true.The
SILLocation::pointsToEndfunction checks the primary location to see if it has a 1 as it's PointerIntPair's integer value.Therefore, if we know that the
SILLocationbeing passed in when creating ourExtendedASTNodeLocis pointing to theEndLocof theswift::Stmt, we need to set the primaryASTNodeTy's integer to 1.