Enable clang-tidy forward reference checks
Clang-13 adds new checks we can turn on, which find quite a few errors.
Tested: Code compiles
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I74b780760014c898cc440b37aea640b33e91c439
diff --git a/http/app.hpp b/http/app.hpp
index 4735197..b4ccd95 100644
--- a/http/app.hpp
+++ b/http/app.hpp
@@ -47,7 +47,7 @@
template <typename Adaptor>
void handleUpgrade(const Request& req, Response& res, Adaptor&& adaptor)
{
- router.handleUpgrade(req, res, std::move(adaptor));
+ router.handleUpgrade(req, res, std::forward<Adaptor>(adaptor));
}
void handle(Request& req,
diff --git a/http/routing.hpp b/http/routing.hpp
index fe9c7e9..c8946e4 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -208,7 +208,7 @@
const Request&>::value,
int>::type = 0)
{
- handler = [f = std::move(f)](
+ handler = [f = std::forward<Func>(f)](
const Request&,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Args... args) { asyncResp->res.result(f(args...)); };
@@ -565,7 +565,7 @@
"types: "
"string, int, crow::response, nlohmann::json");
- handler = [f = std::move(f)](
+ handler = [f = std::forward<Func>(f)](
const Request&,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Args... args) { asyncResp->res.result(f(args...)); };
@@ -591,7 +591,7 @@
"types: "
"string, int, crow::response,nlohmann::json");
- handler = [f = std::move(f)](
+ handler = [f = std::forward<Func>(f)](
const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
Args... args) { asyncResp->res.result(f(req, args...)); };
@@ -624,7 +624,7 @@
"return "
"type");
- handler = std::move(f);
+ handler = std::forward<Func>(f);
}
template <typename Func>
@@ -1201,7 +1201,8 @@
// any uncaught exceptions become 500s
try
{
- rules[ruleIndex]->handleUpgrade(req, res, std::move(adaptor));
+ rules[ruleIndex]->handleUpgrade(req, res,
+ std::forward<Adaptor>(adaptor));
}
catch (const std::exception& e)
{