This is an archive of the discontinued LLVM Phabricator instance.

[clang-tidy] Applied clang-tidy fixes. NFC
ClosedPublic

Authored by alexfh on Jan 28 2021, 6:42 AM.

Details

Summary

Applied fixes enabled by the LLVM's .clang-tidy configs. Reverted files where
fixes introduced compile errors:

clang-tools-extra/clang-tidy/hicpp/NoAssemblerCheck.cpp
clang-tools-extra/clang-tidy/misc/ThrowByValueCatchByReferenceCheck.cpp

$ clang-tools-extra/clang-tidy/tool/run-clang-tidy.py -fix clang-tools-extra/clang-tidy/
Enabled checks:

llvm-else-after-return
llvm-header-guard
llvm-include-order
llvm-namespace-comment
llvm-prefer-isa-or-dyn-cast-in-conditionals
llvm-prefer-register-over-unsigned
llvm-qualified-auto
llvm-twine-local
misc-definitions-in-headers
misc-misplaced-const
misc-new-delete-overloads
misc-no-recursion
misc-non-copyable-objects
misc-redundant-expression
misc-static-assert
misc-throw-by-value-catch-by-reference
misc-unconventional-assign-operator
misc-uniqueptr-reset-release
misc-unused-alias-decls
misc-unused-using-decls
readability-identifier-naming

Diff Detail

Event Timeline

alexfh created this revision.Jan 28 2021, 6:42 AM
alexfh requested review of this revision.Jan 28 2021, 6:42 AM
Herald added a project: Restricted Project. · View Herald TranscriptJan 28 2021, 6:42 AM
aaron.ballman accepted this revision.Jan 28 2021, 9:27 AM

LGTM, thank you for the cleanup!

This revision is now accepted and ready to land.Jan 28 2021, 9:27 AM
alexfh updated this revision to Diff 319979.Jan 28 2021, 3:51 PM

Manually cleaned up suboptimal fixes.

clang-tools-extra/clang-tidy/abseil/TimeSubtractionCheck.cpp
96

Changing this to const char *.

clang-tools-extra/clang-tidy/bugprone/ArgumentCommentCheck.cpp
283

Changing this to FunctionDecl *.

clang-tools-extra/clang-tidy/bugprone/BranchCloneCheck.cpp
192–194

This comes from llvm-qualified-auto. Iterator being a pointer is an implementation detail, thus the fix is not helpful. Reverting it.

clang-tools-extra/clang-tidy/bugprone/CopyConstructorInitCheck.cpp
113

Removed this manually.

clang-tools-extra/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp
109–110

This comes from llvm-qualified-auto. Iterator being a pointer is an implementation detail, thus the fix is not helpful. Reverting it.

For the context:
using param_iterator = MutableArrayRef<ParmVarDecl *>::iterator;
...
param_iterator param_begin() ...

clang-tools-extra/clang-tidy/bugprone/NotNullTerminatedResultCheck.cpp
923

Removing this const, since it doesn't bring anything here.

clang-tools-extra/clang-tidy/bugprone/SizeofExpressionCheck.cpp
42–43

Removing this one too. The check outputs just one diagnostic per if - else if - else if chain for some reason.

clang-tools-extra/clang-tidy/hicpp/MultiwayPathsCoveredCheck.cpp
87–88

Removing this one too. The llvm-else-after-return check outputs just one diagnostic per if - else if - else if chain for some reason.

clang-tools-extra/clang-tidy/modernize/AvoidBindCheck.cpp
337 ↗(On Diff #319854)

Iterator being a pointer is an implementation detail. Reverting.

clang-tools-extra/clang-tidy/modernize/DeprecatedIosBaseAliasesCheck.cpp
62

Changing to const char *.

clang-tools-extra/clang-tidy/modernize/MakeSmartPtrCheck.cpp
389–390

Fixing indentation.

clang-tools-extra/clang-tidy/modernize/UseOverrideCheck.cpp
175

Reverting this (iterator doesn't have to be a pointer).

clang-tools-extra/clang-tidy/modernize/UseUsingCheck.cpp
61–65

Removed the use of auto here.

clang-tools-extra/clang-tidy/performance/InefficientStringConcatenationCheck.cpp
72

Changing to const char *.

clang-tools-extra/clang-tidy/plugin/ClangTidyPlugin.cpp
41–42

Removed this variable.

clang-tools-extra/clang-tidy/readability/InconsistentDeclarationParameterNameCheck.cpp
108–109 ↗(On Diff #319854)

Reverting.

alexfh updated this revision to Diff 319981.Jan 28 2021, 3:57 PM

Trying to upload complete patch.

This revision was landed with ongoing or failed builds.Jan 28 2021, 4:01 PM
This revision was automatically updated to reflect the committed changes.