--- /dev/null
+#pragma once
+
+namespace std {
+namespace experimental {
+
+template <typename ret_t, typename... args_t>
+struct coroutine_traits {
+ using promise_type = typename ret_t::promise_type;
+};
+
+template <class promise_t>
+struct coroutine_handle {
+ static constexpr coroutine_handle from_address(void *addr) noexcept { return {}; };
+};
+
+} // namespace experimental
+} // namespace std
+
+struct never_suspend {
+ bool await_ready() noexcept { return false; }
+ template <typename coro_t>
+ void await_suspend(coro_t handle) noexcept {}
+ void await_resume() noexcept {}
+};
+
+struct task {
+ struct promise_type {
+ task get_return_object() noexcept { return {}; }
+ never_suspend initial_suspend() noexcept { return {}; }
+ never_suspend final_suspend() noexcept { return {}; }
+ void return_void() {}
+ void unhandled_exception() {}
+ };
+};
// RUN: {key: readability-identifier-naming.LocalPointerPrefix, value: 'l_'}, \
// RUN: {key: readability-identifier-naming.LocalConstantPointerCase, value: CamelCase}, \
// RUN: {key: readability-identifier-naming.LocalConstantPointerPrefix, value: 'lc_'}, \
-// RUN: ]}' -- -fno-delayed-template-parsing -Dbad_macro \
+// RUN: ]}' -- -fno-delayed-template-parsing -Dbad_macro -std=c++17 -fcoroutines-ts \
// RUN: -I%S/Inputs/readability-identifier-naming \
// RUN: -isystem %S/Inputs/readability-identifier-naming/system
// clang-format off
#include <system-header.h>
+#include <coroutines.h>
#include "user-header.h"
// NO warnings or fixes expected from declarations within header files without
// the -header-filter= option
// Overriding a badly-named base isn't a new violation.
void BadBaseMethod() override {}
// CHECK-FIXES: {{^}} void v_Bad_Base_Method() override {}
-
+
void foo() {
BadBaseMethod();
// CHECK-FIXES: {{^}} v_Bad_Base_Method();
auto GetRes(type_t& Param) -> decltype(Param.res());
// CHECK-MESSAGES: :[[@LINE-1]]:21: warning: invalid case style for parameter 'Param'
// CHECK-FIXES: auto GetRes(type_t& a_param) -> decltype(a_param.res());
+
+// Check implicit declarations in coroutines
+
+struct async_obj {
+public:
+ never_suspend operator co_await() const noexcept;
+};
+
+task ImplicitDeclTest(async_obj &a_object) {
+ co_await a_object; // CHECK-MESSAGES-NOT: warning: invalid case style for local variable
+}
auto *VD = VarDecl::Create(Context, FD, FD->getLocation(), FD->getLocation(),
&PP.getIdentifierTable().get("__promise"), T,
Context.getTrivialTypeSourceInfo(T, Loc), SC_None);
+ VD->setImplicit();
CheckVariableDeclarationType(VD);
if (VD->isInvalidDecl())
return nullptr;
S.Context, &FD, FD.getLocation(), FD.getLocation(),
&S.PP.getIdentifierTable().get("__coro_gro"), GroType,
S.Context.getTrivialTypeSourceInfo(GroType, Loc), SC_None);
+ GroDecl->setImplicit();
S.CheckVariableDeclarationType(GroDecl);
if (GroDecl->isInvalidDecl())