-
Notifications
You must be signed in to change notification settings - Fork 10.5k
LifetimeDependenceDiagnostics: bug fixes and output clarity #81191
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
Changes from all commits
36551e3
c891d8a
49755bd
25e9cbf
ec51286
83b0ce1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -452,7 +452,7 @@ public enum VariableScopeInstruction { | |
|
||
// TODO: with SIL verification, we might be able to make varDecl non-Optional. | ||
public var varDecl: VarDecl? { | ||
if let debugVarDecl = instruction.debugVarDecl { | ||
if let debugVarDecl = instruction.debugResultDecl { | ||
return debugVarDecl | ||
} | ||
// SILGen may produce double var_decl instructions for the same variable: | ||
|
@@ -474,15 +474,31 @@ extension Instruction { | |
if let varScopeInst = VariableScopeInstruction(self) { | ||
return varScopeInst.varDecl | ||
} | ||
return debugVarDecl | ||
return debugResultDecl | ||
} | ||
|
||
var debugVarDecl: VarDecl? { | ||
var debugResultDecl: VarDecl? { | ||
for result in results { | ||
for use in result.uses { | ||
if let debugVal = use.instruction as? DebugValueInst { | ||
return debugVal.varDecl | ||
} | ||
if let varDecl = result.debugUserDecl { | ||
return varDecl | ||
} | ||
} | ||
return nil | ||
} | ||
} | ||
|
||
extension Value { | ||
var debugValDecl: VarDecl? { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same here: this belongs more to OptUtils. |
||
if let arg = self as? Argument { | ||
return arg.varDecl | ||
} | ||
return debugUserDecl | ||
} | ||
|
||
var debugUserDecl: VarDecl? { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The same here |
||
for use in uses { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if let debugVal = use.instruction as? DebugValueInst { | ||
return debugVal.varDecl | ||
} | ||
} | ||
return nil | ||
|
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.
I don't think it's good to combine
getDecl
and the lookup ofdebug_value
users into a single API.I think it's better to directly bridge
getDecl
(returning aDecl
) and addvarDecl
on top of this. AndvarDecl
belongs more to OptUtils than defining it in the "raw" SIL, because it looks at a bigger SIL structure (including the users) than the Argument in isolation.