[SIL] Specialize the source locations for ReturnLocation and ImplicitReturnLocation.

Swift SVN r7913
This commit is contained in:
Anna Zaks
2013-09-04 21:57:44 +00:00
parent 62ad1cca30
commit 8fae98d5c6
2 changed files with 12 additions and 2 deletions

View File

@@ -31,6 +31,16 @@ SourceLoc SILLocation::getSourceLoc() const {
return getEndSourceLoc();
}
// Use the end location for the ImplicitReturnKind.
if (getKind() == ImplicitReturnKind) {
return getEndSourceLoc();
}
// Use the start location for the ReturnKind.
if (getKind() == ReturnKind) {
return getStartSourceLoc();
}
if (auto decl = ASTNode.dyn_cast<Decl*>())
return decl->getLoc();
if (auto expr = ASTNode.dyn_cast<Expr*>())