[CodeCompletion] Add type relation indicators to completion results at the conditions of repeat-while statements.

Boolean expressions should have higher priority at loop conditions.
This commit is contained in:
Xi Ge
2015-12-11 14:35:31 -08:00
parent 06d6dab133
commit b797871ed2
3 changed files with 41 additions and 2 deletions

View File

@@ -4186,6 +4186,7 @@ public:
switch (S->getKind()) {
case StmtKind::Return:
case StmtKind::ForEach:
case StmtKind::RepeatWhile:
return true;
default:
return false;
@@ -4249,6 +4250,15 @@ public:
}
break;
}
case StmtKind::RepeatWhile: {
auto Cond = cast<RepeatWhileStmt>(Parent)->getCond();
if (Cond &&
SM.rangeContains(Cond->getSourceRange(),
ParsedExpr->getSourceRange())) {
Callback(Context.getBoolDecl()->getDeclaredType());
}
break;
}
default:
llvm_unreachable("Unhandled statement kinds.");
}