Skip to content
New issue

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

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

Already on GitHub? # to your account

[clang-tidy][task 5] enable modernize-make-shared and fix existing linter errors #55807

Merged

Conversation

SigureMo
Copy link
Member

@SigureMo SigureMo commented Jul 29, 2023

PR types

Others

PR changes

Others

Description

apt install clang-tidy-10

python ./tools/codestyle/clang-tidy.py -p=build -j=10 -extra-arg=-Wno-unknown-warning-option \
-extra-arg=-Wno-pessimizing-move \
-extra-arg=-Wno-braced-scalar-init \
-extra-arg=-Wno-deprecated-copy \
-extra-arg=-Wno-dangling-gsl \
-extra-arg=-Wno-final-dtor-non-final-class \
-extra-arg=-Wno-implicit-int-float-conversion \
-extra-arg=-Wno-inconsistent-missing-override \
-extra-arg=-Wno-infinite-recursion \
-extra-arg=-Wno-mismatched-tags  \
-extra-arg=-Wno-self-assign \
-extra-arg=-Wno-sign-compare \
-extra-arg=-Wno-sometimes-uninitialized \
-extra-arg=-Wno-tautological-overlap-compare \
-extra-arg=-Wno-unused-const-variable \
-extra-arg=-Wno-unused-lambda-capture \
-extra-arg=-Wno-unused-private-field \
-extra-arg=-Wno-unused-value \
-extra-arg=-Wno-unused-variable  \
-extra-arg=-Wno-overloaded-virtual  \
-extra-arg=-Wno-defaulted-function-deleted  \
-extra-arg=-Wno-delete-non-abstract-non-virtual-dtor  \
-extra-arg=-Wno-return-type-c-linkage -j=10  > clang-tidy.log  2>&1

grep "modernize-make-shared" clang-tidy.log

800 多个基本全是自动生成的(我这里统计是 847 个),因此修改模板后剩下的不多了,另外已经启用的 modernize-make-uniquemodernize-redundant-void-arg 明显有一些存量的,会在 pre-commit 时候阻塞 commit(需要加 --no-verify 才能过),相关 PR 应该尽快合入

PCard-66962

@paddle-bot
Copy link

paddle-bot bot commented Jul 29, 2023

你的PR提交成功,感谢你对开源项目的贡献!
请关注后续CI自动化测试结果,详情请参考Paddle-CI手册
Your PR has been submitted. Thanks for your contribution!
Please wait for the result of CI firstly. See Paddle CI Manual for details.

# which contains "complex128" as data. "complex128" is memory-aligned manually. But make_shared
# request MEMALIGN for allocation (Maybe).
# See https://stackoverflow.com/questions/31228656/how-can-shared-ptr-disrupt-alignment
# and https://github.com/MRtrix3/mrtrix3/issues/957
node_construction_str = f"{indent}auto grad_node = std::shared_ptr<{grad_node_name}>(new {grad_node_name}({num_backward_inputs}, {num_backward_outputs}));"
node_assignment_str = f"{indent}grad_node = std::shared_ptr<{grad_node_name}>(new {grad_node_name}({num_backward_inputs}, {num_backward_outputs}));"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

加 NOLINT 原因见上面的 NOTE,因此相关的 GradNode 均 NOLINT 了,包括手写的和自动生成的

@SigureMo SigureMo requested a review from zhangbo9674 August 1, 2023 01:21
@paddle-ci-bot
Copy link

paddle-ci-bot bot commented Aug 7, 2023

Sorry to inform you that a65c472's CIs have passed for more than 7 days. To prevent PR conflicts, you need to re-run all CIs manually.

zhangbo9674
zhangbo9674 previously approved these changes Aug 29, 2023
@luotao1
Copy link
Contributor

luotao1 commented Aug 29, 2023

请解决下冲突

@luotao1 luotao1 merged commit ac80251 into PaddlePaddle:develop Aug 30, 2023
@SigureMo SigureMo deleted the clang-tidy/modernize-make-shared branch August 30, 2023 08:04
BeingGod pushed a commit to BeingGod/Paddle that referenced this pull request Sep 9, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants