[Sema] Use isa<> instead of dyn_cast<> as pointer is never dereferenced. NFCI.
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 15 Nov 2020 12:56:32 +0000 (12:56 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Sun, 15 Nov 2020 12:58:36 +0000 (12:58 +0000)
We are only checking for the class type. Fixes Wshadow warnings.

clang/lib/Sema/CodeCompleteConsumer.cpp

index f1ad8ae..678a09b 100644 (file)
@@ -356,8 +356,7 @@ const char *CodeCompletionAllocator::CopyString(const Twine &String) {
 }
 
 StringRef CodeCompletionTUInfo::getParentName(const DeclContext *DC) {
-  const NamedDecl *ND = dyn_cast<NamedDecl>(DC);
-  if (!ND)
+  if (!isa<NamedDecl>(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<NamedDecl>(DC);
-  if (!ND)
+  if (!isa<NamedDecl>(DC))
     return;
 
   ParentName = getCodeCompletionTUInfo().getParentName(DC);