From 1a1fbdc6efede45777d8a3b94ba915a9fa2e3294 Mon Sep 17 00:00:00 2001 From: Henry Wong Date: Tue, 27 Nov 2018 04:27:00 +0000 Subject: [PATCH] [clangd] NFC: Prefer `isa<>` to `dyn_cast<>` to do the checking. Summary: Prefer `isa<>` to `dyn_cast<>` when there only need a checking. Reviewers: ilya-biryukov, MaskRay Reviewed By: ilya-biryukov, MaskRay Subscribers: ioeric, MaskRay, jkorous, arphaman, kadircet, cfe-commits, MTC Differential Revision: https://reviews.llvm.org/D54878 llvm-svn: 347635 --- clang-tools-extra/clangd/AST.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/clang-tools-extra/clangd/AST.cpp b/clang-tools-extra/clangd/AST.cpp index 9d4a61f77f59..c5e34ef0353b 100644 --- a/clang-tools-extra/clangd/AST.cpp +++ b/clang-tools-extra/clangd/AST.cpp @@ -95,11 +95,11 @@ std::string printName(const ASTContext &Ctx, const NamedDecl &ND) { return Out.str(); } // The name was empty, so present an anonymous entity. - if (llvm::dyn_cast(&ND)) + if (isa(ND)) return "(anonymous namespace)"; if (auto *Cls = llvm::dyn_cast(&ND)) return ("(anonymous " + Cls->getKindName() + ")").str(); - if (llvm::dyn_cast(&ND)) + if (isa(ND)) return "(anonymous enum)"; return "(anonymous)"; }