Author: Simon Pilgrim Date: 2020-11-15T12:58:36Z New Revision: 5e373b2e94d714a7250e961029a58bae5585f33e
URL: https://github.com/llvm/llvm-project/commit/5e373b2e94d714a7250e961029a58bae5585f33e DIFF: https://github.com/llvm/llvm-project/commit/5e373b2e94d714a7250e961029a58bae5585f33e.diff LOG: [Sema] Use isa<> instead of dyn_cast<> as pointer is never dereferenced. NFCI. We are only checking for the class type. Fixes Wshadow warnings. Added: Modified: clang/lib/Sema/CodeCompleteConsumer.cpp Removed: ################################################################################ diff --git a/clang/lib/Sema/CodeCompleteConsumer.cpp b/clang/lib/Sema/CodeCompleteConsumer.cpp index f1ad8aeaacbb..678a09ba1003 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<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); _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits