[IDE] Fix visiting DeferStmt

* Call balanced walkToStmtPost() for DeferStmt.
* In walkToStmtPre(), return DeferStmt itself instead of the body.

rdar://problem/39948168
This commit is contained in:
Rintaro Ishizaki
2018-05-08 16:21:22 +09:00
parent a5c91f65f1
commit 1fa04208e0
3 changed files with 22 additions and 4 deletions

View File

@@ -677,11 +677,16 @@ std::pair<bool, Stmt *> ModelASTWalker::walkToStmtPre(Stmt *S) {
}
} else if (auto *DeferS = dyn_cast<DeferStmt>(S)) {
// Since 'DeferStmt::getTempDecl()' is marked as implicit, we manually walk
// into the body.
if (auto *FD = DeferS->getTempDecl()) {
auto *RetS = FD->getBody()->walk(*this);
// Already walked children.
return { false, RetS };
assert(RetS == FD->getBody());
(void)RetS;
walkToStmtPost(DeferS);
}
// Already walked children.
return { false, DeferS };
}
return { true, S };