Merge pull request #14029 from ethereum/clang-std-forward

Use `std::` prefix with `std::forward()` as well to satisfy Clang
This commit is contained in:
Kamil Śliwak 2023-03-06 19:28:40 +01:00 committed by GitHub
commit 94ebcc9742
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 5 additions and 4 deletions

View File

@ -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

View File

@ -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.

View File

@ -84,7 +84,7 @@ ASTPointer<T> ASTJsonImporter::createASTNode(Json::Value const& _node, Args&&...
auto n = make_shared<T>(
id,
createSourceLocation(_node),
forward<Args>(_args)...
std::forward<Args>(_args)...
);
return n;
}

View File

@ -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
)