when emitting the epilog 'return 0' for top level code, mark it as autogenerated,

fixing <rdar://problem/19664185> Pointless "always evaluates to true" warning in while true loops at the top level

Also, merge test/SILPasses/diagnose_unreachable_two_while_loops.swift into SILPasses/unreachable_code.swift.


Swift SVN r27696
This commit is contained in:
Chris Lattner
2015-04-24 18:22:57 +00:00
parent edee327df3
commit 3973d376ab
4 changed files with 17 additions and 13 deletions

View File

@@ -812,9 +812,10 @@ public:
if (sgm.TopLevelSGF) {
// Write out the epilog.
auto moduleLoc = RegularLocation::getModuleLocation();
auto returnInfo
= sgm.TopLevelSGF->emitEpilogBB(moduleLoc);
moduleLoc.markAutoGenerated();
auto returnInfo = sgm.TopLevelSGF->emitEpilogBB(moduleLoc);
auto returnLoc = returnInfo.second;
returnLoc.markAutoGenerated();
// Signal a normal return to the OS by returning 0.
auto &B = sgm.TopLevelSGF->B;