[clang-tools-extra] 7aa2ce0 - [NFC][clangd] fix clang-tidy finding on isa_and_nonnull

Christian Kühnel via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 18 01:25:48 PST 2021


Author: Christian Kühnel
Date: 2021-11-18T09:16:54Z
New Revision: 7aa2ce0fab3c21cf87c5884f6bf8bdece1b6fe1c

URL: https://github.com/llvm/llvm-project/commit/7aa2ce0fab3c21cf87c5884f6bf8bdece1b6fe1c
DIFF: https://github.com/llvm/llvm-project/commit/7aa2ce0fab3c21cf87c5884f6bf8bdece1b6fe1c.diff

LOG: [NFC][clangd] fix clang-tidy finding on isa_and_nonnull

This is a cleanup of the only llvm-prefer-isa-or-dyn-cast-in-conditionals finding in the clangd code base. This patch was created by automatically applying the fixes from clang-tidy.

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

Added: 
    

Modified: 
    clang-tools-extra/clangd/Selection.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/Selection.cpp b/clang-tools-extra/clangd/Selection.cpp
index e945f5d79b2c..0b10c7a3a6f9 100644
--- a/clang-tools-extra/clangd/Selection.cpp
+++ b/clang-tools-extra/clangd/Selection.cpp
@@ -500,7 +500,7 @@ class SelectionVisitor : public RecursiveASTVisitor<SelectionVisitor> {
   //  - those without source range information, we don't record those
   //  - those that can't be stored in DynTypedNode.
   bool TraverseDecl(Decl *X) {
-    if (X && isa<TranslationUnitDecl>(X))
+    if (llvm::isa_and_nonnull<TranslationUnitDecl>(X))
       return Base::TraverseDecl(X); // Already pushed by constructor.
     // Base::TraverseDecl will suppress children, but not this node itself.
     if (X && X->isImplicit())


        


More information about the cfe-commits mailing list