Simplify the API and implementation of Stack (#667)

This commit is contained in:
Geoff Romer
2021-07-20 14:27:41 -07:00
committed by GitHub
parent 8fccecadeb
commit 08a2d44570
6 changed files with 43 additions and 100 deletions
+6 -5
View File
@@ -84,12 +84,13 @@ void Action::Print(llvm::raw_ostream& out) const {
}
}
void Action::PrintList(Stack<Action*> ls, llvm::raw_ostream& out) {
if (!ls.IsEmpty()) {
out << *ls.Pop();
if (!ls.IsEmpty()) {
void Action::PrintList(const Stack<Action*>& ls, llvm::raw_ostream& out) {
auto it = ls.begin();
while (it != ls.end()) {
out << **it;
++it;
if (it != ls.end()) {
out << " :: ";
PrintList(ls, out);
}
}
}