mirror of
https://github.com/revng/revng
synced 2026-06-21 14:07:57 +00:00
cfb47157b9
This commit fixes all the non-compliance with our preliminary clang-tidy configuration, which will be merged soon.
45 lines
848 B
C++
45 lines
848 B
C++
#pragma once
|
|
|
|
//
|
|
// This file is distributed under the MIT License. See LICENSE.md for details.
|
|
//
|
|
|
|
#include <iostream>
|
|
#include <vector>
|
|
|
|
#include "revng/ADT/RecursiveCoroutine.h"
|
|
|
|
struct MyState {
|
|
int Depth;
|
|
};
|
|
|
|
inline RecursiveCoroutine<int> get10() {
|
|
rc_return 10;
|
|
}
|
|
|
|
inline RecursiveCoroutine<> myCoroutine(std::vector<MyState> &RCS, int Y) {
|
|
int X = 1;
|
|
std::cerr << "Pre " << Y << ':';
|
|
RCS.back().Depth = Y;
|
|
|
|
for (const MyState &S : RCS) {
|
|
std::cerr << ' ' << S.Depth;
|
|
}
|
|
std::cerr << std::endl;
|
|
|
|
if (Y < (rc_recur get10())) {
|
|
RCS.emplace_back();
|
|
rc_recur myCoroutine(RCS, Y + 1);
|
|
}
|
|
|
|
std::cerr << "Post " << Y << ' ' << X << std::endl;
|
|
RCS.pop_back();
|
|
rc_return;
|
|
}
|
|
|
|
inline RecursiveCoroutine<void> accumulateSums(int I, int &Result) {
|
|
Result += I;
|
|
if (I)
|
|
rc_recur accumulateSums(I - 1, Result);
|
|
}
|