[PATCH] D118698: [clangd][nfc] cleanup of remaining clang-tidy findings
Christian Kühnel via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Feb 1 05:47:14 PST 2022
kuhnel created this revision.
kuhnel added a reviewer: sammccall.
Herald added subscribers: usaxena95, kadircet, arphaman.
kuhnel requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
There were some left-overs (or new things) from the previous patches.
This will get us down to 0 open findings except:
clang-tidy is complaining in some files about
`warning: #includes are not sorted properly [llvm-include-order]`
however, clang-format does revert these changes.
It looks like clang-tidy and clang-format disagree there.
Not sure how we can fix that...
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118698
Files:
clang-tools-extra/clangd/ConfigYAML.cpp
clang-tools-extra/clangd/XRefs.cpp
clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
Index: clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
===================================================================
--- clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -42,7 +42,6 @@
using ::testing::Pair;
using ::testing::SizeIs;
using ::testing::UnorderedElementsAre;
-using testing::UnorderedElementsAreArray;
::testing::Matcher<const Diag &> withFix(::testing::Matcher<Fix> FixMatcher) {
return Field(&Diag::Fixes, ElementsAre(FixMatcher));
Index: clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
===================================================================
--- clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
+++ clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
@@ -254,8 +254,9 @@
if (auto *T = Node->ASTNode.get<TypeLoc>()) {
if (T->getAs<ElaboratedTypeLoc>()) {
break;
- } else if (Node->Parent->ASTNode.get<TypeLoc>() ||
- Node->Parent->ASTNode.get<NestedNameSpecifierLoc>()) {
+ }
+ if (Node->Parent->ASTNode.get<TypeLoc>() ||
+ Node->Parent->ASTNode.get<NestedNameSpecifierLoc>()) {
// Node is TypeLoc, but it's parent is either TypeLoc or
// NestedNameSpecifier. In both cases, we want to go up, to find
// the outermost TypeLoc.
Index: clang-tools-extra/clangd/XRefs.cpp
===================================================================
--- clang-tools-extra/clangd/XRefs.cpp
+++ clang-tools-extra/clangd/XRefs.cpp
@@ -1930,9 +1930,9 @@
// FIXME: use HeuristicResolver to unwrap smart pointers?
// Function type => return type.
- if (auto FT = T->getAs<FunctionType>())
+ if (auto *FT = T->getAs<FunctionType>())
return unwrapFindType(FT->getReturnType());
- if (auto CRD = T->getAsCXXRecordDecl()) {
+ if (auto *CRD = T->getAsCXXRecordDecl()) {
if (CRD->isLambda())
return unwrapFindType(CRD->getLambdaCallOperator()->getReturnType());
// FIXME: more cases we'd prefer the return type of the call operator?
Index: clang-tools-extra/clangd/ConfigYAML.cpp
===================================================================
--- clang-tools-extra/clangd/ConfigYAML.cpp
+++ clang-tools-extra/clangd/ConfigYAML.cpp
@@ -349,8 +349,7 @@
if (auto Scalar = scalarValue(N, Desc)) {
if (auto Bool = llvm::yaml::parseBool(**Scalar))
return Located<bool>(*Bool, Scalar->Range);
- else
- warning(Desc + " should be a boolean", N);
+ warning(Desc + " should be a boolean", N);
}
return llvm::None;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118698.404899.patch
Type: text/x-patch
Size: 2592 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220201/daccc7ee/attachment.bin>
More information about the cfe-commits
mailing list