Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make lsp happy #364

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .clangd
@@ -0,0 +1,3 @@
CompileFlags:
Add: [-std=c++20, -Wno-unknown-warning-option]
Remove: [-m*, -f*]
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -13,6 +13,7 @@ core.*
!.github
!.gitignore
!.clang-format
!.clangd
*.so
*.a
vgcore.*
Expand Down
1 change: 0 additions & 1 deletion async_simple/Future.h
Expand Up @@ -20,7 +20,6 @@
#include "async_simple/Executor.h"
#include "async_simple/FutureState.h"
#include "async_simple/LocalState.h"
#include "async_simple/Promise.h"
#include "async_simple/Traits.h"

namespace async_simple {
Expand Down
8 changes: 6 additions & 2 deletions async_simple/Promise.h
Expand Up @@ -98,7 +98,9 @@ class Promise {
logicAssert(valid(), "Promise is broken");
_sharedState->setResult(Try<value_type>(error));
}
void setValue(value_type&& v) requires(!std::is_void_v<T>) {
void setValue(value_type&& v)
requires(!std::is_void_v<T>)
{
logicAssert(valid(), "Promise is broken");
_sharedState->setResult(Try<value_type>(std::forward<T>(v)));
}
Expand All @@ -107,7 +109,9 @@ class Promise {
_sharedState->setResult(std::move(t));
}

void setValue() requires(std::is_void_v<T>) {
void setValue()
requires(std::is_void_v<T>)
{
logicAssert(valid(), "Promise is broken");
_sharedState->setResult(Try<value_type>(Unit()));
}
Expand Down
1 change: 0 additions & 1 deletion async_simple/Unit.h
Expand Up @@ -18,7 +18,6 @@

#include <exception>
#include "async_simple/Common.h"
#include "async_simple/Try.h"

namespace async_simple {

Expand Down
2 changes: 2 additions & 0 deletions async_simple/coro/test/FutureAwaiterTest.cpp
Expand Up @@ -15,6 +15,8 @@
*/
#include <chrono>
#include <thread>

#include "async_simple/Promise.h"
#include "async_simple/coro/FutureAwaiter.h"
#include "async_simple/coro/Lazy.h"
#include "async_simple/coro/SyncAwait.h"
Expand Down
1 change: 1 addition & 0 deletions async_simple/coro/test/ResumeByScheduleTest.cpp
Expand Up @@ -14,6 +14,7 @@
* limitations under the License.
*/

#include "async_simple/Promise.h"
#include "async_simple/coro/Lazy.h"
#include "async_simple/coro/ResumeBySchedule.h"
#include "async_simple/executors/SimpleExecutor.h"
Expand Down
1 change: 1 addition & 0 deletions async_simple/test/FutureTest.cpp
Expand Up @@ -27,6 +27,7 @@ import async_simple;
#else
#include "async_simple/Collect.h"
#include "async_simple/Future.h"
#include "async_simple/Promise.h"
#include "async_simple/executors/SimpleExecutor.h"
#include "async_simple/test/unittest.h"
#endif
Expand Down
2 changes: 2 additions & 0 deletions async_simple/uthread/Latch.h
Expand Up @@ -18,6 +18,8 @@

#include <type_traits>
#include "async_simple/Future.h"
#include "async_simple/Promise.h"
#include "async_simple/uthread/Await.h"

namespace async_simple {
namespace uthread {
Expand Down
3 changes: 2 additions & 1 deletion async_simple/uthread/internal/thread.h
Expand Up @@ -27,6 +27,7 @@
#include <type_traits>

#include "async_simple/Future.h"
#include "async_simple/Promise.h"
#include "async_simple/uthread/internal/thread_impl.h"

namespace async_simple {
Expand Down Expand Up @@ -70,4 +71,4 @@ class thread_context {
} // namespace uthread
} // namespace async_simple

#endif // ASYNC_SIMPLE_UTHREAD_INTERNAL_THREAD_H
#endif // ASYNC_SIMPLE_UTHREAD_INTERNAL_THREAD_H
1 change: 1 addition & 0 deletions benchmarks/Future.bench.cpp
Expand Up @@ -17,6 +17,7 @@

#include "async_simple/Collect.h"
#include "async_simple/Future.h"
#include "async_simple/Promise.h"
#include "async_simple/executors/SimpleExecutor.h"

#include <memory>
Expand Down
7 changes: 4 additions & 3 deletions demo_example/ReadFiles.cpp
Expand Up @@ -23,6 +23,7 @@
import async_simple;
#else
#include "async_simple/Future.h"
#include "async_simple/Promise.h"
#include "async_simple/coro/Lazy.h"
#include "async_simple/coro/SyncAwait.h"
#include "async_simple/executors/SimpleExecutor.h"
Expand Down Expand Up @@ -61,9 +62,9 @@ uint64_t CountCharInFiles(const std::vector<FileName> &Files, char c) {

template <class T>
concept Range = requires(T &t) {
t.begin();
t.end();
};
t.begin();
t.end();
};

// It is not travial to implement an asynchronous do_for_each.
template <typename InputIt, typename Callable>
Expand Down