From 5e373b2e94d714a7250e961029a58bae5585f33e Mon Sep 17 00:00:00 2001 From: Simon Pilgrim Date: Sun, 15 Nov 2020 12:56:32 +0000 Subject: [PATCH] [Sema] Use isa<> instead of dyn_cast<> as pointer is never dereferenced. NFCI. We are only checking for the class type. Fixes Wshadow warnings. --- clang/lib/Sema/CodeCompleteConsumer.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp index f1ad8ae..678a09b 100644 --- a/clang/lib/Sema/CodeCompleteConsumer.cpp +++ b/clang/lib/Sema/CodeCompleteConsumer.cpp @@ -356,8 +356,7 @@ const char *CodeCompletionAllocator::CopyString(const Twine &String) { } StringRef CodeCompletionTUInfo::getParentName(const DeclContext *DC) { - const NamedDecl *ND = dyn_cast(DC); - if (!ND) + if (!isa(DC)) return {}; // Check whether we've already cached the parent name. @@ -470,8 +469,7 @@ void CodeCompletionBuilder::addParentContext(const DeclContext *DC) { if (DC->isFunctionOrMethod()) return; - const NamedDecl *ND = dyn_cast(DC); - if (!ND) + if (!isa(DC)) return; ParentName = getCodeCompletionTUInfo().getParentName(DC); -- 2.7.4