From 817a57b365ff16603f3b50e598ef27dbfd9b3380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20=C5=9Aliwak?= Date: Mon, 6 Mar 2023 18:20:49 +0100 Subject: [PATCH] Use std:: prefix with std::forward() as well to satisfy Clang --- CODING_STYLE.md | 2 +- ReviewChecklist.md | 2 +- libsolidity/ast/ASTJsonImporter.cpp | 2 +- scripts/check_style.sh | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CODING_STYLE.md b/CODING_STYLE.md index 2b1e36fc6..87b6166d1 100644 --- a/CODING_STYLE.md +++ b/CODING_STYLE.md @@ -55,7 +55,7 @@ To set indentation and tab width settings uniformly, the repository contains an 3. All symbols should be declared in a namespace except for final applications. 4. Use anonymous namespaces for helpers whose scope is a cpp file only. 5. Preprocessor symbols should be prefixed with the namespace in all-caps and an underscore. -6. Do not use `std::` qualifier in cpp files (see 2.), except for `std::move`, which will otherwise cause the `check_style` step to fail. +6. Do not use `std::` qualifier in cpp files (see 2.), except for `std::move` and `std::forward`, which will otherwise cause the `check_style` step to fail. Only in the header: ```cpp diff --git a/ReviewChecklist.md b/ReviewChecklist.md index c85a50546..3f0af6f98 100644 --- a/ReviewChecklist.md +++ b/ReviewChecklist.md @@ -102,7 +102,7 @@ The following points are all covered by the coding style but come up so often th already used elsewhere in the same expression. - [ ] **Indent braces and parentheses in a way that makes nesting clear.** - [ ] **Use `using namespace` only in `.cpp` files.** Use it for `std` and our own modules. - Avoid unnecessary `std::` prefix in `.cpp` files (except for `std::move`). + Avoid unnecessary `std::` prefix in `.cpp` files (except for `std::move` and `std::forward`). - [ ] **Use range-based loops and destructuring.** - [ ] **Include any headers you use directly,** even if they are implicitly included through other headers. diff --git a/libsolidity/ast/ASTJsonImporter.cpp b/libsolidity/ast/ASTJsonImporter.cpp index 4f4b9c17b..a1201983f 100644 --- a/libsolidity/ast/ASTJsonImporter.cpp +++ b/libsolidity/ast/ASTJsonImporter.cpp @@ -84,7 +84,7 @@ ASTPointer ASTJsonImporter::createASTNode(Json::Value const& _node, Args&&... auto n = make_shared( id, createSourceLocation(_node), - forward(_args)... + std::forward(_args)... ); return n; } diff --git a/scripts/check_style.sh b/scripts/check_style.sh index e3dbe6cb6..0953106d3 100755 --- a/scripts/check_style.sh +++ b/scripts/check_style.sh @@ -55,8 +55,9 @@ FORMATERROR=$( preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | grep -E -v "return [&]" # right-aligned reference ampersand (needs to exclude return) # right-aligned reference pointer star (needs to exclude return and comments) preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | grep -E -v -e "return [*]" -e "^* [*]" -e "^*//.*" - # unqualified move check, i.e. make sure that std::move() is used instead of move() + # unqualified move()/forward() checks, i.e. make sure that std::move() and std::forward() are used instead of move() and forward() preparedGrep "move\(.+\)" | grep -v "std::move" | grep -E "[^a-z]move" + preparedGrep "forward\(.+\)" | grep -v "std::forward" | grep -E "[^a-z]forward" ) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" || true )