[clang-tools-extra] 2f8da95 - [clangd][nfc] cleanup of remaining clang-tidy findings

Christian Kühnel via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 3 04:07:41 PST 2022


Author: Christian Kühnel
Date: 2022-02-03T12:05:25Z
New Revision: 2f8da95e070e0f6b8c3d3310de51b016176e840a

URL: https://github.com/llvm/llvm-project/commit/2f8da95e070e0f6b8c3d3310de51b016176e840a
DIFF: https://github.com/llvm/llvm-project/commit/2f8da95e070e0f6b8c3d3310de51b016176e840a.diff

LOG: [clangd][nfc] cleanup of remaining clang-tidy findings

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

Reviewed By: sammccall

Differential Revision: https://reviews.llvm.org/D118698

Added: 
    

Modified: 
    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

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/ConfigYAML.cpp b/clang-tools-extra/clangd/ConfigYAML.cpp
index 0c758b6d296d4..9015de26c91f4 100644
--- a/clang-tools-extra/clangd/ConfigYAML.cpp
+++ b/clang-tools-extra/clangd/ConfigYAML.cpp
@@ -349,8 +349,7 @@ class Parser {
     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;
   }

diff  --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp
index fea143e67824b..be1361f8bd278 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -1928,9 +1928,9 @@ static QualType unwrapFindType(QualType T) {
   // 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?

diff  --git a/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp b/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
index eee64d84fda63..2b67034da8d48 100644
--- a/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
+++ b/clang-tools-extra/clangd/refactor/tweaks/AddUsing.cpp
@@ -254,8 +254,9 @@ bool AddUsing::prepare(const Selection &Inputs) {
     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.

diff  --git a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
index b060935145999..7de3746d22511 100644
--- a/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
+++ b/clang-tools-extra/clangd/unittests/DiagnosticsTests.cpp
@@ -42,7 +42,6 @@ using ::testing::IsEmpty;
 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));


        


More information about the cfe-commits mailing list